(t *testing.T)
| 111 | } |
| 112 | |
| 113 | func TestFunctionJoin(t *testing.T) { |
| 114 | table := []struct { |
| 115 | input string |
| 116 | expected interface{} |
| 117 | name string |
| 118 | }{ |
| 119 | {"join(fromJSON('[\"a\", \"b\"]'), ',')", "a,b", "join-arr"}, |
| 120 | {"join('string', ',')", "string", "join-str"}, |
| 121 | {"join(1, ',')", "1", "join-number"}, |
| 122 | {"join(null, ',')", "", "join-number"}, |
| 123 | {"join(fromJSON('[\"a\", \"b\", null]'), null)", "ab", "join-number"}, |
| 124 | {"join(fromJSON('[\"a\", \"b\"]'))", "a,b", "join-number"}, |
| 125 | {"join(fromJSON('[\"a\", \"b\", null]'), 1)", "a1b1", "join-number"}, |
| 126 | } |
| 127 | |
| 128 | env := &EvaluationEnvironment{} |
| 129 | |
| 130 | for _, tt := range table { |
| 131 | t.Run(tt.name, func(t *testing.T) { |
| 132 | output, err := NewInterpeter(env, Config{}).Evaluate(tt.input, DefaultStatusCheckNone) |
| 133 | assert.Nil(t, err) |
| 134 | |
| 135 | assert.Equal(t, tt.expected, output) |
| 136 | }) |
| 137 | } |
| 138 | } |
| 139 | |
| 140 | func TestFunctionToJSON(t *testing.T) { |
| 141 | table := []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…