(t *testing.T)
| 82 | } |
| 83 | |
| 84 | func TestFunctionEndsWith(t *testing.T) { |
| 85 | table := []struct { |
| 86 | input string |
| 87 | expected interface{} |
| 88 | name string |
| 89 | }{ |
| 90 | {"endsWith('search', 'ch') }}", true, "endsWith-string"}, |
| 91 | {"endsWith('search', 'sa') }}", false, "endsWith-string"}, |
| 92 | {"endsWith('search123s', '123s') }}", true, "endsWith-string"}, |
| 93 | {"endsWith(123, 's') }}", false, "endsWith-string"}, |
| 94 | {"endsWith(123, '23') }}", true, "endsWith-string"}, |
| 95 | {"endsWith('123', 23) }}", true, "endsWith-string"}, |
| 96 | {"endsWith(null, '42') }}", false, "endsWith-string"}, |
| 97 | {"endsWith('null', null) }}", true, "endsWith-string"}, |
| 98 | {"endsWith('null', '') }}", true, "endsWith-string"}, |
| 99 | } |
| 100 | |
| 101 | env := &EvaluationEnvironment{} |
| 102 | |
| 103 | for _, tt := range table { |
| 104 | t.Run(tt.name, func(t *testing.T) { |
| 105 | output, err := NewInterpeter(env, Config{}).Evaluate(tt.input, DefaultStatusCheckNone) |
| 106 | assert.Nil(t, err) |
| 107 | |
| 108 | assert.Equal(t, tt.expected, output) |
| 109 | }) |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | func TestFunctionJoin(t *testing.T) { |
| 114 | table := []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…