Skip to content

Commit

Permalink
Add test for parsing Node::Call
Browse files Browse the repository at this point in the history
  • Loading branch information
couchand committed Mar 7, 2023
1 parent 58157fe commit 1366d70
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions askama_derive/src/parser/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -662,3 +662,28 @@ fn test_missing_space_after_kw() {
let err = super::parse("{%leta=b%}", &syntax).unwrap_err();
assert_eq!(err, "unable to parse template:\n\n\"{%leta=b%}\"");
}

#[test]
fn test_parse_call_statement() {
let syntax = Syntax::default();
assert_eq!(
super::parse("{% call foo(bar) %}", &syntax).unwrap(),
vec![Node::Call(
Ws(None, None),
None,
"foo",
vec![
Expr::Var("bar"),
],
)],
);
assert_eq!(
super::parse("{% call foo::bar() %}", &syntax).unwrap(),
vec![Node::Call(
Ws(None, None),
Some("foo"),
"bar",
vec![],
)],
);
}

0 comments on commit 1366d70

Please sign in to comment.