| 2589 | } |
| 2590 | |
| 2591 | func TestIssue624(t *testing.T) { |
| 2592 | type tag struct { |
| 2593 | Name string |
| 2594 | } |
| 2595 | |
| 2596 | type item struct { |
| 2597 | Tags []tag |
| 2598 | } |
| 2599 | |
| 2600 | i := item{ |
| 2601 | Tags: []tag{ |
| 2602 | {Name: "one"}, |
| 2603 | {Name: "two"}, |
| 2604 | }, |
| 2605 | } |
| 2606 | |
| 2607 | rule := `[ |
| 2608 | true && true, |
| 2609 | one(Tags, .Name in ["one"]), |
| 2610 | one(Tags, .Name in ["two"]), |
| 2611 | one(Tags, .Name in ["one"]) && one(Tags, .Name in ["two"]) |
| 2612 | ]` |
| 2613 | resp, err := expr.Eval(rule, i) |
| 2614 | require.NoError(t, err) |
| 2615 | require.Equal(t, []interface{}{true, true, true, true}, resp) |
| 2616 | } |
| 2617 | |
| 2618 | func TestPredicateCombination(t *testing.T) { |
| 2619 | tests := []struct { |