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