| 1199 | } |
| 1200 | |
| 1201 | func TestParse_pipe_operator(t *testing.T) { |
| 1202 | input := "arr | map(.foo) | len() | Foo()" |
| 1203 | expect := &CallNode{ |
| 1204 | Callee: &IdentifierNode{Value: "Foo"}, |
| 1205 | Arguments: []Node{ |
| 1206 | &BuiltinNode{ |
| 1207 | Name: "len", |
| 1208 | Arguments: []Node{ |
| 1209 | &BuiltinNode{ |
| 1210 | Name: "map", |
| 1211 | Arguments: []Node{ |
| 1212 | &IdentifierNode{Value: "arr"}, |
| 1213 | &PredicateNode{ |
| 1214 | Node: &MemberNode{ |
| 1215 | Node: &PointerNode{}, |
| 1216 | Property: &StringNode{Value: "foo"}, |
| 1217 | }}}}}}}} |
| 1218 | |
| 1219 | actual, err := parser.Parse(input) |
| 1220 | require.NoError(t, err) |
| 1221 | assert.Equal(t, Dump(expect), Dump(actual.Node)) |
| 1222 | } |
| 1223 | |
| 1224 | func TestNodeBudget(t *testing.T) { |
| 1225 | tests := []struct { |