diff options
| author | 2025-01-27 06:44:44 -0500 | |
|---|---|---|
| committer | 2025-01-27 06:44:44 -0500 | |
| commit | 179ad4a9157a082fb34d0cb74e7dd6fcd68088d9 (patch) | |
| tree | aab681af468ac386a814927ae1754c65dc339a1f /tests | |
| parent | indented code block test (diff) | |
expand starts and continues by adding current node as argument
This simplifies the parser at the expense of moving the `add-new-node!`
declaration into the `starts` procedure. This allows for the procedure
to mutate the node when needed, which is needed for properly parsing
pandoc-style grid tables.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/run.scm | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/tests/run.scm b/tests/run.scm index 550534d..4e8c8ae 100644 --- a/tests/run.scm +++ b/tests/run.scm @@ -29,14 +29,14 @@ (test-group "paragraphs" (let ((str - (chain (parse->document "hello, world" #f) + (chain (parse->document "hello, world") (node-children _) (list-queue-list _) (list-ref _ 0) (xstring->string _)))) (test-equal "single line" str "hello, world\n")) (let ((str - (chain (parse->document "hello," #f) + (chain (parse->document "hello,") (parse->document "world" _) (node-children _) (list-queue-list _) @@ -45,7 +45,7 @@ (test-equal "two lines" str "hello,\nworld\n")) (test-group "two paragraphs" (let ((children - (chain (parse->document "hello" #f) + (chain (parse->document "hello") (parse->document "" _) (parse->document "world" _) (node-children _) @@ -59,7 +59,7 @@ (test-group "block quotes" (test-group "single line" - (let ((block (chain (parse->document "> hello, world" #f) + (let ((block (chain (parse->document "> hello, world") (node-children _) (list-queue-list _) (list-ref _ 0)))) @@ -69,7 +69,7 @@ (list-ref _ 0) (xstring->string _)))) (test-equal "string" str "hello, world\n")))) - (let ((str (chain (parse->document "> hello," #f) + (let ((str (chain (parse->document "> hello,") (parse->document "> world" _) (node-children _) (list-queue-list _) @@ -80,7 +80,7 @@ (xstring->string _)))) (test-equal "two lines" str "hello,\nworld\n")) (test-group "multiple paragraphs" - (let ((lst (chain (parse->document "> hello" #f) + (let ((lst (chain (parse->document "> hello") (parse->document "> " _) (parse->document "> world" _) (node-children _) @@ -95,7 +95,7 @@ (xstring->string (list-ref lst 1)) "world\n"))) (test-group "interrupted" - (let ((lst (chain (parse->document "> hello, world" #f) + (let ((lst (chain (parse->document "> hello, world") (parse->document "outside of a block quote" _) (node-children _) (list-queue-list _)))) @@ -116,7 +116,7 @@ (xstring->string (list-ref lst 1))))) (test-group "two nested with spaces" (define block - (chain (parse->document "> > hello, world" #f) + (chain (parse->document "> > hello, world") (parse->document "> > continuing nested" _) (parse->document "> outside of the block quote" _) (node-children _) @@ -143,7 +143,7 @@ (xstring->string _)))) (test-group "two nested without spaces" (define block - (chain (parse->document ">> hello, world" #f) + (chain (parse->document ">> hello, world") (parse->document ">> continuing nested" _) (parse->document "> at first level" _) (parse->document "> continuing first level" _) @@ -170,7 +170,7 @@ (test-group "atx headings" (test-group "heading 1" - (let ((heading (chain (parse->document "# hello" #f) + (let ((heading (chain (parse->document "# hello") (node-children _) (list-queue-list _) (list-ref _ 0)))) @@ -181,7 +181,7 @@ (list-ref _ 0) (xstring->string _))))) (test-group "heading 6" - (let ((heading (chain (parse->document "###### hello" #f) + (let ((heading (chain (parse->document "###### hello") (node-children _) (list-queue-list _) (list-ref _ 0)))) @@ -192,7 +192,7 @@ (list-ref _ 0) (xstring->string _))))) (test-group "heading followed by paragraph" - (let ((children (chain (parse->document "## hello, " #f) + (let ((children (chain (parse->document "## hello, ") (parse->document "world" _) (parse->document "## another heading" _) (node-children _) @@ -218,7 +218,7 @@ (xstring->string _))) (test-equal "text" "another heading" text)))) (test-group "heading inside block quote" - (let ((children (chain (parse->document "> # nested heading" #f) + (let ((children (chain (parse->document "> # nested heading") (parse->document "> text inside quote" _) (parse->document "### outside of quote" _) (node-children _) @@ -253,7 +253,7 @@ (test-group "code blocks" (test-group "single line, 4 spaces" - (let ((block (chain (parse->document " (procedure? call/cc)" #f) + (let ((block (chain (parse->document " (procedure? call/cc)") (node-children _) (list-queue-list _) (list-ref _ 0)))) @@ -265,7 +265,7 @@ (list-ref _ 0) (xstring->string _))))) (test-group "single line, tab" - (let ((block (chain (parse->document "\t(procedure? call/cc)" #f) + (let ((block (chain (parse->document "\t(procedure? call/cc)") (node-children _) (list-queue-list _) (list-ref _ 0)))) @@ -277,7 +277,7 @@ (list-ref _ 0) (xstring->string _))))) (test-group "multiple lines, mixing" - (let ((str (chain (parse->document " (lambda (x)" #f) + (let ((str (chain (parse->document " (lambda (x)") (parse->document "\t x)" _) (node-children _) (list-queue-list _) @@ -290,7 +290,7 @@ "(lambda (x)\n x)\n" str))) (test-group "no quotes in code blocks" - (let ((first-child (chain (parse->document " > not a block" #f) + (let ((first-child (chain (parse->document " > not a block") (node-children _) (list-queue-list _) (list-ref _ 0) @@ -302,7 +302,7 @@ "> not a block\n" (xstring->string first-child)))) (test-group "code block in quotes" - (let ((node (chain (parse->document "> quoted code" #f) + (let ((node (chain (parse->document "> quoted code") (node-children _) (list-queue-list _) (list-ref _ 0)))) |
