Add a test proving that nested lists are exited by two blank lines.
This commit is contained in:
parent
75a47deedd
commit
ba9ef7907f
@ -267,7 +267,6 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn two_blank_lines_ends_list() {
|
||||
// Plain lists with an asterisk bullet must be indented or else they would be a headline
|
||||
let input = r#"1. foo
|
||||
2. bar
|
||||
baz
|
||||
@ -291,6 +290,31 @@ mod tests {
|
||||
3. lorem
|
||||
|
||||
|
||||
"#
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn two_blank_lines_ends_nested_list() {
|
||||
// Plain lists with an asterisk bullet must be indented or else they would be a headline
|
||||
let input = r#"1. foo
|
||||
1. bar
|
||||
|
||||
|
||||
baz"#;
|
||||
let initial_context: ContextTree<'_, '_> = ContextTree::new();
|
||||
let document_context =
|
||||
initial_context.with_additional_node(ContextElement::DocumentRoot(input));
|
||||
let plain_list_matcher = parser_with_context!(plain_list)(&document_context);
|
||||
let (remaining, result) =
|
||||
plain_list_matcher(input).expect("Should parse the plain list successfully.");
|
||||
assert_eq!(remaining, "baz");
|
||||
assert_eq!(
|
||||
result.get_source(),
|
||||
r#"1. foo
|
||||
1. bar
|
||||
|
||||
|
||||
"#
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user