Commit graph

14 commits

Author SHA1 Message Date
Abhinav Gupta
282e1428bc ParseTestCaseFile: Don't panic
Instead of panicking, ParseTestCaseFile now reports errors.
The errors take the form,

    line $line: $msg: $cause

For example,

    line 12: invalid case No: parse error

As a result of this change,
we no longer discard the error returned by strconv.Atoi or json.Marshal
when we reject the test file,
and include it in the error message instead.

Note that the errors do not include the file name
because the file name is always the same
so the caller can add that if necessary
(which it will, in the next commit).
2022-11-11 08:24:20 -08:00
Abhinav Gupta
eb17108b43 testutil: Add ParseTestCaseFile
This moves the logic for parsing a test case file
into a separate function named ParseTestCaseFile.
This will make it easier for extensions
to use the same format for test files,
even if they want a different strategy to run them.

The function does not do filtering like DoTestCaseFile;
that logic has been left inside DoTestCaseFile.

Minus that, this function does not modify any logic.
The next commits do.
2022-11-11 08:24:20 -08:00
yuin
f6e93ffd8f Fix #274, Fix #275 2022-02-08 17:15:15 +09:00
yuin
351308fb72 Fix #245 - 4 2021-09-11 11:20:50 +09:00
yuin
f37563cfa8 Add options for test cases 2021-09-11 11:08:36 +09:00
yuin
759cc35c3a Fix #229 2021-06-28 08:05:35 +09:00
yuin
16e27ac471 Add DiffPretty 2021-05-15 19:42:58 +09:00
yuin
9e0189df27 Closes #161
- Implement footnote configurations defined in original markdown extra.
- Add OwnerDocument() method to ast.Node
- Add Meta() method to *ast.Document
2020-12-13 23:11:07 +09:00
yuin
feff0bb82b Add case=x,x.. aruguments for tests 2020-07-02 15:28:33 +09:00
yuin
3d78558cf2 Test case now can have a description 2020-05-22 18:42:44 +09:00
Cameron Moore
3dc5ebdb17 Fix golint issues 2019-11-29 13:31:28 -06:00
yuin
16b69522a4 Remove the WithWorkers option
Situations that concurrent inline parsing is effective are very limited
due to goroutine overheads and a parse context sharing mutex.
2019-10-31 17:46:02 +09:00
Yusuke Inuzuka
187643a437 Performance improvements, Add BlockParser.Trigger 2019-08-30 16:36:00 +09:00
Abhinav Gupta
8c55e6fa9c Move test utilities to testutil/
This moves the following functions meant for use from tests into a
testutil subpackage.

    func DoTestCase(m Markdown, testCase MarkdownTestCase, t TestingT)
    func DoTestCaseFile(m Markdown, filename string, t TestingT)
    func DoTestCases(m goldmark.Markdown, cases []MarkdownTestCase, t TestingT)

This will help keep the top-level goldmark package clean and limited to
core functionality.

(Note that tests in the top-level goldmark package that make use of
these functions must now use the package name `goldmark_test` so that
they're considered separate from the main `goldmark` package, otherwise
you'll see an import cycle: goldmark imports testutil imports goldmark.)
2019-08-25 03:18:18 -07:00
Renamed from testutil.go (Browse further)