(t *testing.T)
| 348 | } |
| 349 | |
| 350 | func TestSetFuncVariadic(t *testing.T) { |
| 351 | vm := New() |
| 352 | vm.Set("f", func(s string, g ...Value) { |
| 353 | something := g[0].ToObject(vm).Get(s).ToInteger() |
| 354 | if something != 5 { |
| 355 | t.Fatal() |
| 356 | } |
| 357 | }) |
| 358 | _, err := vm.RunString(` |
| 359 | f("something", {something: 5}) |
| 360 | `) |
| 361 | if err != nil { |
| 362 | t.Fatal(err) |
| 363 | } |
| 364 | } |
| 365 | |
| 366 | func TestSetFuncVariadicFuncArg(t *testing.T) { |
| 367 | vm := New() |