Skip to content

Commit 5052a11

Browse files
committed
Add test for nested else if handling
1 parent b02b0cf commit 5052a11

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

parser/parser_test.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -669,6 +669,19 @@ world`},
669669
Exp1: &IntegerNode{Value: 2},
670670
Exp2: &IntegerNode{Value: 3}}},
671671
},
672+
{
673+
"if a { 1 } else if b { 2 } else if c { 3 } else { 4 }",
674+
&ConditionalNode{
675+
Cond: &IdentifierNode{Value: "a"},
676+
Exp1: &IntegerNode{Value: 1},
677+
Exp2: &ConditionalNode{
678+
Cond: &IdentifierNode{Value: "b"},
679+
Exp1: &IntegerNode{Value: 2},
680+
Exp2: &ConditionalNode{
681+
Cond: &IdentifierNode{Value: "c"},
682+
Exp1: &IntegerNode{Value: 3},
683+
Exp2: &IntegerNode{Value: 4}}}},
684+
},
672685
{
673686
"1; 2; 3",
674687
&SequenceNode{

0 commit comments

Comments
 (0)