From fbdf40fed0abfb14ba9a311028193486c615e942 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sat, 22 Apr 2023 00:19:01 -0400 Subject: [PATCH] Fix failing tests that were relying on the captured trailing whitespace. --- src/parser/footnote_definition.rs | 13 ++++++------- src/parser/plain_list.rs | 6 +++--- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/parser/footnote_definition.rs b/src/parser/footnote_definition.rs index b4e5f29f..ffc4c522 100644 --- a/src/parser/footnote_definition.rs +++ b/src/parser/footnote_definition.rs @@ -110,6 +110,7 @@ mod tests { use crate::parser::parser_context::ContextElement; use crate::parser::parser_context::ContextTree; use crate::parser::parser_with_context::parser_with_context; + use crate::parser::Source; use super::*; @@ -123,21 +124,20 @@ line footnote."; let initial_context: ContextTree<'_, '_> = ContextTree::new(); let document_context = initial_context.with_additional_node(ContextElement::DocumentRoot(input)); - let footnote_definition_matcher = - parser_with_context!(footnote_definition)(&document_context); + let footnote_definition_matcher = parser_with_context!(element)(&document_context); let (remaining, first_footnote_definition) = footnote_definition_matcher(input).expect("Parse first footnote_definition"); let (remaining, second_footnote_definition) = footnote_definition_matcher(remaining).expect("Parse second footnote_definition."); assert_eq!(remaining, ""); assert_eq!( - first_footnote_definition.source, + first_footnote_definition.get_source(), "[fn:1] A footnote. " ); assert_eq!( - second_footnote_definition.source, + second_footnote_definition.get_source(), "[fn:2] A multi- line footnote." @@ -155,13 +155,12 @@ not in the footnote."; let initial_context: ContextTree<'_, '_> = ContextTree::new(); let document_context = initial_context.with_additional_node(ContextElement::DocumentRoot(input)); - let footnote_definition_matcher = - parser_with_context!(footnote_definition)(&document_context); + let footnote_definition_matcher = parser_with_context!(element)(&document_context); let (remaining, first_footnote_definition) = footnote_definition_matcher(input).expect("Parse first footnote_definition"); assert_eq!(remaining, "not in the footnote."); assert_eq!( - first_footnote_definition.source, + first_footnote_definition.get_source(), "[fn:2] A multi- line footnote. diff --git a/src/parser/plain_list.rs b/src/parser/plain_list.rs index 73c4c86a..4e5704f3 100644 --- a/src/parser/plain_list.rs +++ b/src/parser/plain_list.rs @@ -370,7 +370,7 @@ mod tests { 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 plain_list_matcher = parser_with_context!(element)(&document_context); let (remaining, result) = plain_list_matcher(input).expect("Should parse the plain list successfully."); assert_eq!(remaining, " ipsum\n"); @@ -396,7 +396,7 @@ 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 plain_list_matcher = parser_with_context!(element)(&document_context); let (remaining, result) = plain_list_matcher(input).expect("Should parse the plain list successfully."); assert_eq!(remaining, "baz"); @@ -427,7 +427,7 @@ dolar"#; 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 plain_list_matcher = parser_with_context!(element)(&document_context); let (remaining, result) = plain_list_matcher(input).expect("Should parse the plain list successfully."); assert_eq!(remaining, "dolar");