Add test for failing if expression

This commit is contained in:
greg 2019-09-28 17:42:22 -07:00
parent 489819a28e
commit f02d7cb924
1 changed files with 19 additions and 0 deletions

View File

@ -340,6 +340,24 @@ fn parsing_bindings() {
));
}
#[test]
fn parsing_if_expressions() {
parse_test_wrap_ast! {
"if x == 10 { 1 } else { 2 }",
exst!(IfExpression {
discriminator: bx! {
Discriminator::Simple(ex!(Call { f: bx!(ex!(val!("a"))), arguments: vec![]}))
},
body: bx! {
IfExpressionBody::SimpleConditional(
vec![exst!(Call { f: bx!(ex!(val!("b"))), arguments: vec![]}), exst!(Call { f: bx!(ex!(val!("c"))), arguments: vec![] })],
None
)
}
})
}
}
#[test]
fn parsing_block_expressions() {
parse_test_wrap_ast! {
@ -760,3 +778,4 @@ fn imports_4() {
})
}
}