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

@@ -111,27 +111,26 @@ fn footnote_definition_end<'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;
use crate::parser::Source;
#[test]
fn two_paragraphs() {
let input = "[fn:1] A footnote.
let input = OrgSource::new(
"[fn:1] A footnote.
[fn:2] A multi-
line footnote.";
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!(element(true))(&document_context);
let footnote_definition_matcher = parser_with_context!(element(true))(&initial_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!(Into::<&str>::into(remaining), "");
assert_eq!(
first_footnote_definition.get_source(),
"[fn:1] A footnote.
@@ -148,19 +147,19 @@ line footnote."
#[test]
fn multiline_break() {
let input = "[fn:2] A multi-
let input = OrgSource::new(
"[fn:2] A multi-
line footnote.
not in the footnote.";
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!(element(true))(&document_context);
let footnote_definition_matcher = parser_with_context!(element(true))(&initial_context);
let (remaining, first_footnote_definition) =
footnote_definition_matcher(input).expect("Parse first footnote_definition");
assert_eq!(remaining, "not in the footnote.");
assert_eq!(Into::<&str>::into(remaining), "not in the footnote.");
assert_eq!(
first_footnote_definition.get_source(),
"[fn:2] A multi-