(t *testing.T)
| 138 | } |
| 139 | |
| 140 | func TestFunctionToJSON(t *testing.T) { |
| 141 | table := []struct { |
| 142 | input string |
| 143 | expected interface{} |
| 144 | name string |
| 145 | }{ |
| 146 | {"toJSON(env) }}", "{\n \"key\": \"value\"\n}", "toJSON"}, |
| 147 | {"toJSON(null)", "null", "toJSON-null"}, |
| 148 | } |
| 149 | |
| 150 | env := &EvaluationEnvironment{ |
| 151 | Env: map[string]string{ |
| 152 | "key": "value", |
| 153 | }, |
| 154 | } |
| 155 | |
| 156 | for _, tt := range table { |
| 157 | t.Run(tt.name, func(t *testing.T) { |
| 158 | output, err := NewInterpeter(env, Config{}).Evaluate(tt.input, DefaultStatusCheckNone) |
| 159 | assert.Nil(t, err) |
| 160 | |
| 161 | assert.Equal(t, tt.expected, output) |
| 162 | }) |
| 163 | } |
| 164 | } |
| 165 | |
| 166 | func TestFunctionFromJSON(t *testing.T) { |
| 167 | table := []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…