Skip to content

Bug: Testscript passes when it should fail #2

@cassamajor

Description

@cassamajor

Here is the Main function for match:

func Main() int {
	m, err := NewMatcher(
		WithSearchTextFromArgs(os.Args[1:]),
	)
	if err != nil {
		fmt.Fprintln(os.Stderr, err)
		return 1
	}
	m.PrintMatchingLines()
	return 0
}

Let's remove the ability to process arguments

func Main() int {
	m, err := NewMatcher()
	if err != nil {
		fmt.Fprintln(os.Stderr, err)
		return 1
	}
	m.PrintMatchingLines()
	return 0
}

Executing the tests will still pass.


Let's also modify matches_lines_from_stdin.txtar to add one additional line that should match

stdin three_matching_lines.txt
exec match MAGIC
stdout -count=1 '^this line is MAGIC\n'
stdout -count=1 '^MAGIC is also on this line\n'
stdout -count=1 '^and MAGIC is here too\n'

-- three_matching_lines.txt --
this won't match
this line is MAGIC

MAGIC is also on this line
but not this one
and MAGIC is here too
MAGIC is a lie

Tests still pass, even though we haven't added a stdout directive to match the new line.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions