aboutsummaryrefslogtreecommitdiff
path: root/markdown/ast_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'markdown/ast_test.go')
-rw-r--r--markdown/ast_test.go29
1 files changed, 20 insertions, 9 deletions
diff --git a/markdown/ast_test.go b/markdown/ast_test.go
index 8f701f4..ed2ef87 100644
--- a/markdown/ast_test.go
+++ b/markdown/ast_test.go
@@ -45,14 +45,25 @@ var parsed = `
</figure>
`
-func TestAst(t *testing.T) {
- res, err := Parse(raw, nil)
- if err != nil {
- t.Fatal(err)
- }
- wanted := strings.ReplaceAll(parsed, "\n", "")
- if string(res) != wanted {
- t.Errorf("invalid string, got\n%s", res)
- t.Logf("wanted\n%s", wanted)
+func test(input, expected string) func(*testing.T) {
+ return testWithOptions(nil, input, expected)
+}
+
+func testWithOptions(opt *Option, input, expected string) func(*testing.T) {
+ return func(t *testing.T) {
+ t.Parallel()
+ got, err := Parse(input, opt)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if string(got) != expected {
+ t.Errorf("invalid value, got %s", got)
+ }
}
}
+
+func TestAst(t *testing.T) {
+ t.Run("ast", func(t *testing.T) {
+ t.Run("complete", test(raw, strings.ReplaceAll(parsed, "\n", "")))
+ })
+}