Fix tests.
This commit is contained in:
parent
bd04451d58
commit
688779ba40
@ -131,12 +131,11 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn plain_text_radio_target() {
|
fn plain_text_radio_target() {
|
||||||
let input = "foo bar baz";
|
let input = "foo bar baz";
|
||||||
|
let radio_target_match = vec![Object::PlainText(PlainText { source: "bar" })];
|
||||||
let initial_context: ContextTree<'_, '_> = ContextTree::new();
|
let initial_context: ContextTree<'_, '_> = ContextTree::new();
|
||||||
let document_context = initial_context
|
let document_context = initial_context
|
||||||
.with_additional_node(ContextElement::DocumentRoot(input))
|
.with_additional_node(ContextElement::DocumentRoot(input))
|
||||||
.with_additional_node(ContextElement::RadioTarget(vec![vec![Object::PlainText(
|
.with_additional_node(ContextElement::RadioTarget(vec![&radio_target_match]));
|
||||||
PlainText { source: "bar" },
|
|
||||||
)]]));
|
|
||||||
let paragraph_matcher = parser_with_context!(element(true))(&document_context);
|
let paragraph_matcher = parser_with_context!(element(true))(&document_context);
|
||||||
let (remaining, first_paragraph) = paragraph_matcher(input).expect("Parse first paragraph");
|
let (remaining, first_paragraph) = paragraph_matcher(input).expect("Parse first paragraph");
|
||||||
let first_paragraph = match first_paragraph {
|
let first_paragraph = match first_paragraph {
|
||||||
@ -161,15 +160,14 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn bold_radio_target() {
|
fn bold_radio_target() {
|
||||||
let input = "foo *bar* baz";
|
let input = "foo *bar* baz";
|
||||||
|
let radio_target_match = vec![Object::Bold(Bold {
|
||||||
|
source: "*bar*",
|
||||||
|
children: vec![Object::PlainText(PlainText { source: "bar" })],
|
||||||
|
})];
|
||||||
let initial_context: ContextTree<'_, '_> = ContextTree::new();
|
let initial_context: ContextTree<'_, '_> = ContextTree::new();
|
||||||
let document_context = initial_context
|
let document_context = initial_context
|
||||||
.with_additional_node(ContextElement::DocumentRoot(input))
|
.with_additional_node(ContextElement::DocumentRoot(input))
|
||||||
.with_additional_node(ContextElement::RadioTarget(vec![vec![Object::Bold(
|
.with_additional_node(ContextElement::RadioTarget(vec![&radio_target_match]));
|
||||||
Bold {
|
|
||||||
source: "*bar*",
|
|
||||||
children: vec![Object::PlainText(PlainText { source: "bar" })],
|
|
||||||
},
|
|
||||||
)]]));
|
|
||||||
let paragraph_matcher = parser_with_context!(element(true))(&document_context);
|
let paragraph_matcher = parser_with_context!(element(true))(&document_context);
|
||||||
let (remaining, first_paragraph) = paragraph_matcher(input).expect("Parse first paragraph");
|
let (remaining, first_paragraph) = paragraph_matcher(input).expect("Parse first paragraph");
|
||||||
let first_paragraph = match first_paragraph {
|
let first_paragraph = match first_paragraph {
|
||||||
|
Loading…
Reference in New Issue
Block a user