@@ -65,9 +65,12 @@ func TestParse(t *testing.T) {
65
65
},
66
66
{
67
67
"(1 - 2) * 3" ,
68
- & ast.BinaryNode {Operator : "*" ,
69
- Left : & ast.BinaryNode {Operator : "-" , Left : & ast.IntegerNode {Value : 1 },
70
- Right : & ast.IntegerNode {Value : 2 }}, Right : & ast.IntegerNode {Value : 3 },
68
+ & ast.BinaryNode {
69
+ Operator : "*" ,
70
+ Left : & ast.BinaryNode {
71
+ Operator : "-" , Left : & ast.IntegerNode {Value : 1 },
72
+ Right : & ast.IntegerNode {Value : 2 },
73
+ }, Right : & ast.IntegerNode {Value : 3 },
71
74
},
72
75
},
73
76
{
@@ -126,7 +129,8 @@ func TestParse(t *testing.T) {
126
129
"foo.bar().foo().baz[33]" ,
127
130
& ast.IndexNode {
128
131
Node : & ast.PropertyNode {Node : & ast.MethodNode {Node : & ast.MethodNode {
129
- Node : & ast.IdentifierNode {Value : "foo" }, Method : "bar" , Arguments : []ast.Node {}}, Method : "foo" , Arguments : []ast.Node {}}, Property : "baz" },
132
+ Node : & ast.IdentifierNode {Value : "foo" }, Method : "bar" , Arguments : []ast.Node {},
133
+ }, Method : "foo" , Arguments : []ast.Node {}}, Property : "baz" },
130
134
Index : & ast.IntegerNode {Value : 33 },
131
135
},
132
136
},
@@ -194,6 +198,10 @@ func TestParse(t *testing.T) {
194
198
"0 in []" ,
195
199
& ast.BinaryNode {Operator : "in" , Left : & ast.IntegerNode {}, Right : & ast.ArrayNode {Nodes : []ast.Node {}}},
196
200
},
201
+ {
202
+ "not in_var" ,
203
+ & ast.UnaryNode {Operator : "not" , Node : & ast.IdentifierNode {Value : "in_var" }},
204
+ },
197
205
{
198
206
"all(Tickets, {.Price > 0})" ,
199
207
& ast.BuiltinNode {Name : "all" , Arguments : []ast.Node {& ast.IdentifierNode {Value : "Tickets" }, & ast.ClosureNode {Node : & ast.BinaryNode {Operator : ">" , Left : & ast.PropertyNode {Node : & ast.PointerNode {}, Property : "Price" }, Right : & ast.IntegerNode {Value : 0 }}}}},
0 commit comments