From 005aba7a10e91e6c24d46cb0031683e046e2f917 Mon Sep 17 00:00:00 2001 From: greg Date: Tue, 19 Jun 2018 02:35:01 -0700 Subject: [PATCH] Test alt form --- schala-lang/src/parsing.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/schala-lang/src/parsing.rs b/schala-lang/src/parsing.rs index 7358ab5..7018e2d 100644 --- a/schala-lang/src/parsing.rs +++ b/schala-lang/src/parsing.rs @@ -1141,6 +1141,24 @@ fn a(x) { )]) }; + parse_test! { + "if a() then { b(); c() } else { q }", AST(vec![exprstatement!( + IfExpression { + discriminator: bx! { + Discriminator::Simple(ex!(Call { f: bx!(ex!(val!("a"))), arguments: vec![]})) + }, + body: bx! { + IfExpressionBody::SimpleConditional( + vec![exprstatement!(Call { f: bx!(ex!(val!("b"))), arguments: vec![]}), exprstatement!(Call { f: bx!(ex!(val!("c"))), arguments: vec![] })], + Some( + vec![exprstatement!(val!("q"))], + ) + ) + } + } + )]) + }; + /* parse_test!("if a() then { b(); c() }", AST(vec![exprstatement!( IfExpression(bx!(ex!(Call { f: bx!(ex!(val!("a"))), arguments: vec![]})),