Expanded the test definition and fixed part of the problem.
This commit is contained in:
parent
7670db9259
commit
b8c59f012b
@ -147,6 +147,8 @@ pub enum TemplateElement<'a> {
|
|||||||
///
|
///
|
||||||
/// These elements are always wrapped in curly braces
|
/// These elements are always wrapped in curly braces
|
||||||
fn dust_tag(i: &str) -> IResult<&str, DustTag> {
|
fn dust_tag(i: &str) -> IResult<&str, DustTag> {
|
||||||
|
preceded(
|
||||||
|
opt(span_end_of_line),
|
||||||
alt((
|
alt((
|
||||||
map(special, DustTag::DTSpecial),
|
map(special, DustTag::DTSpecial),
|
||||||
map(comment, DustTag::DTComment),
|
map(comment, DustTag::DTComment),
|
||||||
@ -163,7 +165,8 @@ fn dust_tag(i: &str) -> IResult<&str, DustTag> {
|
|||||||
parameterized_block("{@", "ne", DustTag::DTHelperNotEquals),
|
parameterized_block("{@", "ne", DustTag::DTHelperNotEquals),
|
||||||
parameterized_block("{@", "gt", DustTag::DTHelperGreaterThan),
|
parameterized_block("{@", "gt", DustTag::DTHelperGreaterThan),
|
||||||
parameterized_block("{@", "lt", DustTag::DTHelperLessThan),
|
parameterized_block("{@", "lt", DustTag::DTHelperLessThan),
|
||||||
))(i)
|
)),
|
||||||
|
)(i)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Special characters
|
/// Special characters
|
||||||
@ -978,7 +981,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_temp_full_document() {
|
fn test_full_document_new_line_equality() {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
super::template(
|
super::template(
|
||||||
"- simple -{~n}
|
"- simple -{~n}
|
||||||
@ -996,7 +999,40 @@ mod tests {
|
|||||||
TemplateElement::TESpan(Span {
|
TemplateElement::TESpan(Span {
|
||||||
contents: vec!["- simple -"]
|
contents: vec!["- simple -"]
|
||||||
}),
|
}),
|
||||||
TemplateElement::TETag(DustTag::DTSpecial(Special::NewLine))
|
TemplateElement::TETag(DustTag::DTSpecial(Special::NewLine)),
|
||||||
|
TemplateElement::TETag(DustTag::DTSection(Container {
|
||||||
|
path: Path {
|
||||||
|
keys: vec!["names"]
|
||||||
|
},
|
||||||
|
contents: Some(Body {
|
||||||
|
elements: vec![TemplateElement::TETag(DustTag::DTReference(
|
||||||
|
Reference {
|
||||||
|
path: Path { keys: vec![] },
|
||||||
|
filters: vec![]
|
||||||
|
}
|
||||||
|
))]
|
||||||
|
}),
|
||||||
|
else_contents: None,
|
||||||
|
})),
|
||||||
|
TemplateElement::TETag(DustTag::DTSpecial(Special::NewLine)),
|
||||||
|
TemplateElement::TESpan(Span {
|
||||||
|
contents: vec!["- new lines -"]
|
||||||
|
}),
|
||||||
|
TemplateElement::TETag(DustTag::DTSpecial(Special::NewLine)),
|
||||||
|
TemplateElement::TETag(DustTag::DTSection(Container {
|
||||||
|
path: Path {
|
||||||
|
keys: vec!["names"]
|
||||||
|
},
|
||||||
|
contents: Some(Body {
|
||||||
|
elements: vec![TemplateElement::TETag(DustTag::DTReference(
|
||||||
|
Reference {
|
||||||
|
path: Path { keys: vec![] },
|
||||||
|
filters: vec![]
|
||||||
|
}
|
||||||
|
))]
|
||||||
|
}),
|
||||||
|
else_contents: None,
|
||||||
|
})),
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user