Add a special case exit matcher for end of file.

This commit is contained in:
Tom Alexander
2023-03-25 14:45:35 -04:00
parent fc9d131740
commit d2923bfc0f
2 changed files with 19 additions and 0 deletions

View File

@@ -131,4 +131,16 @@ mod tests {
assert_eq!(remaining, "");
assert_eq!(result.source, "1.");
}
#[test]
fn plain_list_item_simple() {
let input = "1. foo";
let initial_context: ContextTree<'_, '_> = ContextTree::new();
let document_context =
initial_context.with_additional_node(ContextElement::DocumentRoot(input));
let plain_list_item_matcher = parser_with_context!(plain_list_item)(&document_context);
let (remaining, result) = plain_list_item_matcher(input).unwrap();
assert_eq!(remaining, "");
assert_eq!(result.source, "1. foo");
}
}