MCPcopy Create free account
hub / github.com/dop251/goja / TestSetFuncVariadic

Function TestSetFuncVariadic

runtime_test.go:350–364  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

348}
349
350func 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
366func TestSetFuncVariadicFuncArg(t *testing.T) {
367 vm := New()

Callers

nothing calls this directly

Calls 6

NewFunction · 0.85
RunStringMethod · 0.80
SetMethod · 0.65
ToIntegerMethod · 0.65
GetMethod · 0.65
ToObjectMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…