DoTestCaseFile: Don't panic

Instead of panicking, report the error in the form,

    $file: $msg

So an error might look like,

    foo.txt: line 12: invalid case No: [..]

And then kill the test with FailNow.
This is the same as calling `t.Fatalf(...)`.
This commit is contained in:
Abhinav Gupta 2022-11-10 19:05:20 -08:00
parent 282e1428bc
commit 86794e96ee

View file

@ -236,7 +236,8 @@ func ParseTestCaseFile(filename string) ([]MarkdownTestCase, error) {
func DoTestCaseFile(m goldmark.Markdown, filename string, t TestingT, no ...int) {
allCases, err := ParseTestCaseFile(filename)
if err != nil {
panic(err)
t.Errorf("%v: %v", filename, err)
t.FailNow()
}
cases := allCases[:0]