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

Function TestCheck

checker/checker_test.go:23–155  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

21)
22
23func TestCheck(t *testing.T) {
24 var tests = []struct {
25 input string
26 }{
27 {"nil == nil"},
28 {"nil == IntPtr"},
29 {"nil == nil"},
30 {"nil in ArrayOfFoo"},
31 {"!Bool"},
32 {"!BoolPtr == Bool"},
33 {"'a' == 'b' + 'c'"},
34 {"'foo' contains 'bar'"},
35 {"'foo' endsWith 'bar'"},
36 {"'foo' startsWith 'bar'"},
37 {"(1 == 1) || (String matches Any)"},
38 {"Int % Int > 1"},
39 {"Int + Int + Int > 0"},
40 {"Int == Any"},
41 {"Int in Int..Int"},
42 {"IntPtrPtr + 1 > 0"},
43 {"1 + 2 + Int64 > 0"},
44 {"Int64 % 1 > 0"},
45 {"IntPtr == Int"},
46 {"FloatPtr == 1 + 2."},
47 {"1 + 2 + Float + 3 + 4 < 0"},
48 {"1 + Int + Float == 0.5"},
49 {"-1 + +1 == 0"},
50 {"1 / 2 == 0"},
51 {"2**3 + 1 != 0"},
52 {"2^3 + 1 != 0"},
53 {"Float == 1"},
54 {"Float < 1.0"},
55 {"Float <= 1.0"},
56 {"Float > 1.0"},
57 {"Float >= 1.0"},
58 {`"a" < "b"`},
59 {"String + (true ? String : String) == ''"},
60 {"(Any ? nil : '') == ''"},
61 {"(Any ? 0 : nil) == 0"},
62 {"(Any ? nil : nil) == nil"},
63 {"!(Any ? Foo : Foo.Bar).Anything"},
64 {"Int in ArrayOfInt"},
65 {"Int not in ArrayOfAny"},
66 {"String in ArrayOfAny"},
67 {"String in ArrayOfString"},
68 {"String in Foo"},
69 {"String in MapOfFoo"},
70 {"String matches 'ok'"},
71 {"String matches Any"},
72 {"String not matches Any"},
73 {"StringPtr == nil"},
74 {"[1, 2, 3] == []"},
75 {"len([]) > 0"},
76 {"Any matches Any"},
77 {"!Any.Things.Contains.Any"},
78 {"!ArrayOfAny[0].next.goes['any thing']"},
79 {"ArrayOfFoo[0].Bar.Baz == ''"},
80 {"ArrayOfFoo[0:10][0].Bar.Baz == ''"},

Callers

nothing calls this directly

Calls 7

ParseFunction · 0.92
NoErrorFunction · 0.92
NewFunction · 0.92
AsBoolFunction · 0.92
NoErrorFunction · 0.92
RunMethod · 0.80
CheckMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…