Expanded the test definition and fixed part of the problem.
This commit is contained in:
parent
7670db9259
commit
b8c59f012b
@ -147,23 +147,26 @@ pub enum TemplateElement<'a> {
|
||||
///
|
||||
/// These elements are always wrapped in curly braces
|
||||
fn dust_tag(i: &str) -> IResult<&str, DustTag> {
|
||||
alt((
|
||||
map(special, DustTag::DTSpecial),
|
||||
map(comment, DustTag::DTComment),
|
||||
map(reference, DustTag::DTReference),
|
||||
conditional("{#", DustTag::DTSection),
|
||||
conditional("{?", DustTag::DTExists),
|
||||
conditional("{^", DustTag::DTNotExists),
|
||||
named_block("{+", DustTag::DTBlock),
|
||||
named_block("{<", DustTag::DTInlinePartial),
|
||||
partial("{>", DustTag::DTPartial),
|
||||
parameterized_block("{@", "gte", DustTag::DTHelperGreaterThenOrEquals),
|
||||
parameterized_block("{@", "lte", DustTag::DTHelperLessThenOrEquals),
|
||||
parameterized_block("{@", "eq", DustTag::DTHelperEquals),
|
||||
parameterized_block("{@", "ne", DustTag::DTHelperNotEquals),
|
||||
parameterized_block("{@", "gt", DustTag::DTHelperGreaterThan),
|
||||
parameterized_block("{@", "lt", DustTag::DTHelperLessThan),
|
||||
))(i)
|
||||
preceded(
|
||||
opt(span_end_of_line),
|
||||
alt((
|
||||
map(special, DustTag::DTSpecial),
|
||||
map(comment, DustTag::DTComment),
|
||||
map(reference, DustTag::DTReference),
|
||||
conditional("{#", DustTag::DTSection),
|
||||
conditional("{?", DustTag::DTExists),
|
||||
conditional("{^", DustTag::DTNotExists),
|
||||
named_block("{+", DustTag::DTBlock),
|
||||
named_block("{<", DustTag::DTInlinePartial),
|
||||
partial("{>", DustTag::DTPartial),
|
||||
parameterized_block("{@", "gte", DustTag::DTHelperGreaterThenOrEquals),
|
||||
parameterized_block("{@", "lte", DustTag::DTHelperLessThenOrEquals),
|
||||
parameterized_block("{@", "eq", DustTag::DTHelperEquals),
|
||||
parameterized_block("{@", "ne", DustTag::DTHelperNotEquals),
|
||||
parameterized_block("{@", "gt", DustTag::DTHelperGreaterThan),
|
||||
parameterized_block("{@", "lt", DustTag::DTHelperLessThan),
|
||||
)),
|
||||
)(i)
|
||||
}
|
||||
|
||||
/// Special characters
|
||||
@ -978,7 +981,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_temp_full_document() {
|
||||
fn test_full_document_new_line_equality() {
|
||||
assert_eq!(
|
||||
super::template(
|
||||
"- simple -{~n}
|
||||
@ -996,7 +999,40 @@ mod tests {
|
||||
TemplateElement::TESpan(Span {
|
||||
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