(t *testing.T)
| 235 | } |
| 236 | |
| 237 | func TestMathStaticErrors(t *testing.T) { |
| 238 | mathTests := []struct { |
| 239 | expr string |
| 240 | err string |
| 241 | }{ |
| 242 | // Tests for math.least |
| 243 | { |
| 244 | expr: "math.least()", |
| 245 | err: "math.least() requires at least one argument", |
| 246 | }, |
| 247 | { |
| 248 | expr: "math.least('hello')", |
| 249 | err: "math.least() invalid single argument value", |
| 250 | }, |
| 251 | { |
| 252 | expr: "math.least({})", |
| 253 | err: "math.least() invalid single argument value", |
| 254 | }, |
| 255 | { |
| 256 | expr: "math.least(1, true)", |
| 257 | err: "math.least() simple literal arguments must be numeric", |
| 258 | }, |
| 259 | { |
| 260 | expr: "math.least(1, 2, true)", |
| 261 | err: "math.least() simple literal arguments must be numeric", |
| 262 | }, |
| 263 | |
| 264 | // Tests for math.greatest |
| 265 | { |
| 266 | expr: "math.greatest()", |
| 267 | err: "math.greatest() requires at least one argument", |
| 268 | }, |
| 269 | { |
| 270 | expr: "math.greatest(true)", |
| 271 | err: "math.greatest() invalid single argument value", |
| 272 | }, |
| 273 | { |
| 274 | expr: "math.greatest([])", |
| 275 | err: "math.greatest() invalid single argument value", |
| 276 | }, |
| 277 | { |
| 278 | expr: "math.greatest([1, true])", |
| 279 | err: "math.greatest() invalid single argument value", |
| 280 | }, |
| 281 | { |
| 282 | expr: "math.greatest(1, true)", |
| 283 | err: "math.greatest() simple literal arguments must be numeric", |
| 284 | }, |
| 285 | { |
| 286 | expr: "math.greatest(1, 2, true)", |
| 287 | err: "math.greatest() simple literal arguments must be numeric", |
| 288 | }, |
| 289 | } |
| 290 | |
| 291 | env := testMathEnv(t) |
| 292 | for i, tst := range mathTests { |
| 293 | tc := tst |
| 294 | t.Run(fmt.Sprintf("%d", i), func(t *testing.T) { |
nothing calls this directly
no test coverage detected