Skip to content

Commit 9de7121

Browse files
author
Lukasz Anforowicz
committed
A few additional unit tests based on the CommonMark spec.
1 parent be8e17f commit 9de7121

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/comment.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2088,6 +2088,10 @@ fn main() {
20882088
run_test("12) foo", "foo", 4, "12) ", " ");
20892089

20902090
run_test(" - foo", "foo", 6, " - ", " ");
2091+
2092+
// https://spec.commonmark.org/0.30 says: "A start number may begin with 0s":
2093+
run_test("0. foo", "foo", 3, "0. ", " ");
2094+
run_test("01. foo", "foo", 4, "01. ", " ");
20912095
}
20922096

20932097
#[test]
@@ -2108,9 +2112,20 @@ fn main() {
21082112
// 1868. He was buried in...
21092113
// ```
21102114
"123. only 2-digit numbers are recognized as item markers.",
2111-
// Parens.
2115+
// Parens:
21122116
"123) giving some coverage to parens as well.",
21132117
"a) giving some coverage to parens as well.",
2118+
// https://spec.commonmark.org/0.30 says that "at least one space or tab is needed
2119+
// between the list marker and any following content":
2120+
"1.Not a list item.",
2121+
"1.2.3. Not a list item.",
2122+
"1)Not a list item.",
2123+
"-Not a list item.",
2124+
"+Not a list item.",
2125+
"+1 not a list item.",
2126+
// https://spec.commonmark.org/0.30 says: "A start number may not be negative":
2127+
"-1. Not a list item.",
2128+
"-1 Not a list item.",
21142129
];
21152130
for line in test_inputs.iter() {
21162131
let maybe_block = ItemizedBlock::new(line);

0 commit comments

Comments
 (0)