Update tests to compile again.

This commit is contained in:
Tom Alexander
2023-08-24 17:15:24 -04:00
parent 3348807a05
commit e84e2b5147
8 changed files with 71 additions and 100 deletions

View File

@@ -69,22 +69,21 @@ fn comment_line<'r, 's>(
#[cfg(test)]
mod tests {
use super::*;
use crate::parser::parser_context::ContextElement;
use crate::parser::parser_context::ContextTree;
use crate::parser::parser_with_context::parser_with_context;
#[test]
fn require_space_after_hash() {
let input = "# Comment line
let input = OrgSource::new(
"# Comment line
#not a comment
# Comment again";
# Comment again",
);
let initial_context: ContextTree<'_, '_> = ContextTree::new();
let document_context =
initial_context.with_additional_node(ContextElement::DocumentRoot(input));
let comment_matcher = parser_with_context!(comment)(&document_context);
let comment_matcher = parser_with_context!(comment)(&initial_context);
let (remaining, first_comment) = comment_matcher(input).expect("Parse first comment");
assert_eq!(
remaining,
Into::<&str>::into(remaining),
r#"#not a comment
# Comment again"#
);