MCPcopy Index your code
hub / github.com/expr-lang/expr / TestOperator_interface

Function TestOperator_interface

test/operator/operator_test.go:37–53  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

35}
36
37func TestOperator_interface(t *testing.T) {
38 env := mock.Env{}
39
40 code := `Foo == "Foo.String" && "Foo.String" == Foo && Time != Foo && Time == Time`
41
42 program, err := expr.Compile(
43 code,
44 expr.Env(mock.Env{}),
45 expr.Operator("==", "StringerStringEqual", "StringStringerEqual", "StringerStringerEqual"),
46 expr.Operator("!=", "NotStringerStringEqual", "NotStringStringerEqual", "NotStringerStringerEqual"),
47 )
48 require.NoError(t, err)
49
50 output, err := expr.Run(program, env)
51 require.NoError(t, err)
52 require.Equal(t, true, output)
53}
54
55type Value struct {
56 Int int

Callers

nothing calls this directly

Calls 6

CompileFunction · 0.92
EnvStruct · 0.92
OperatorFunction · 0.92
NoErrorFunction · 0.92
RunFunction · 0.92
EqualFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…