MCPcopy Create free account
hub / github.com/expr-lang/expr / TestIssue624

Function TestIssue624

expr_test.go:2591–2616  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

2589}
2590
2591func 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 := `[
2608true && true,
2609one(Tags, .Name in ["one"]),
2610one(Tags, .Name in ["two"]),
2611one(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
2618func TestPredicateCombination(t *testing.T) {
2619 tests := []struct {

Callers

nothing calls this directly

Calls 3

EvalFunction · 0.92
NoErrorFunction · 0.92
EqualFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…