Skip to content

Commit 82fcfff

Browse files
committed
Add ternary operator test
1 parent 5bd5818 commit 82fcfff

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

parser/parser_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,10 @@ func TestParse(t *testing.T) {
121121
"true ? true : false",
122122
&ast.ConditionalNode{Cond: &ast.BoolNode{Value: true}, Exp1: &ast.BoolNode{Value: true}, Exp2: &ast.BoolNode{}},
123123
},
124+
{
125+
"a?[b]:c",
126+
&ast.ConditionalNode{Cond: &ast.IdentifierNode{Value: "a"}, Exp1: &ast.ArrayNode{Nodes: []ast.Node{&ast.IdentifierNode{Value: "b"}}}, Exp2: &ast.IdentifierNode{Value: "c"}},
127+
},
124128
{
125129
"a.b().c().d[33]",
126130
&ast.MemberNode{

0 commit comments

Comments
 (0)