Skip to content

Commit

Permalink
A few additional unit tests based on the CommonMark spec.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukasz Anforowicz committed Oct 14, 2022
1 parent be8e17f commit 9de7121
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/comment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2088,6 +2088,10 @@ fn main() {
run_test("12) foo", "foo", 4, "12) ", " ");

run_test(" - foo", "foo", 6, " - ", " ");

// https://spec.commonmark.org/0.30 says: "A start number may begin with 0s":
run_test("0. foo", "foo", 3, "0. ", " ");
run_test("01. foo", "foo", 4, "01. ", " ");
}

#[test]
Expand All @@ -2108,9 +2112,20 @@ fn main() {
// 1868. He was buried in...
// ```
"123. only 2-digit numbers are recognized as item markers.",
// Parens.
// Parens:
"123) giving some coverage to parens as well.",
"a) giving some coverage to parens as well.",
// https://spec.commonmark.org/0.30 says that "at least one space or tab is needed
// between the list marker and any following content":
"1.Not a list item.",
"1.2.3. Not a list item.",
"1)Not a list item.",
"-Not a list item.",
"+Not a list item.",
"+1 not a list item.",
// https://spec.commonmark.org/0.30 says: "A start number may not be negative":
"-1. Not a list item.",
"-1 Not a list item.",
];
for line in test_inputs.iter() {
let maybe_block = ItemizedBlock::new(line);
Expand Down

0 comments on commit 9de7121

Please sign in to comment.