Skip to content

Commit

Permalink
Parser: test comments nested in code blocks
Browse files Browse the repository at this point in the history
See #375.
  • Loading branch information
aantron committed Aug 17, 2019
1 parent 0f14b90 commit 021284e
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
3 changes: 3 additions & 0 deletions test/parser/expect/code-block/comment.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
((output (((f.ml (1 0) (2 14)) (code_block "(* foo *)\
\nlet bar = ()"))))
(warnings ()))
19 changes: 19 additions & 0 deletions test/parser/expect/code-block/docstring-with-code-block.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
((output
(((f.ml (1 0) (1 13)) (code_block "(** {[foo"))
((f.ml (1 14) (2 13))
(paragraph
(((f.ml (1 14) (1 16)) (word "*)")) ((f.ml (1 16) (2 0)) space)
((f.ml (2 0) (2 3)) (word let)) ((f.ml (2 3) (2 4)) space)
((f.ml (2 4) (2 7)) (word bar)) ((f.ml (2 7) (2 8)) space)
((f.ml (2 8) (2 9)) (word =)) ((f.ml (2 9) (2 10)) space)
((f.ml (2 10) (2 12)) (word "()")) ((f.ml (2 12) (2 13)) (word ])))))
((f.ml (2 13) (2 14)) (paragraph (((f.ml (2 13) (2 14)) (word })))))))
(warnings
( "File \"f.ml\", line 1, characters 14-16:\
\nParagraph should begin on its own line."
"File \"f.ml\", line 2, characters 12-13:\
\nUnpaired ']' (end of code).\
\nSuggestion: try '\\]'."
"File \"f.ml\", line 2, characters 13-14:\
\nUnpaired '}' (end of markup).\
\nSuggestion: try '\\}'.")))
3 changes: 3 additions & 0 deletions test/parser/expect/code-block/docstring.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
((output (((f.ml (1 0) (2 14)) (code_block "(** foo *)\
\nlet bar = ()"))))
(warnings ()))
3 changes: 3 additions & 0 deletions test/parser/test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,9 @@ let tests : test_suite list = [
t "unterminated" "{[foo";
t "unterminated-bracket" "{[foo]";
t "trailing-cr" "{[foo\r]}";
t "comment" "{[(* foo *)\nlet bar = ()]}";
t "docstring" "{[(** foo *)\nlet bar = ()]}";
t "docstring-with-code-block" "{[(** {[foo]} *)\nlet bar = ()]}";
];

"verbatim", [
Expand Down

0 comments on commit 021284e

Please sign in to comment.