MCPcopy Index your code
hub / github.com/yuin/gopher-lua / TestOptFunction

Function TestOptFunction

auxlib_test.go:256–269  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

254}
255
256func TestOptFunction(t *testing.T) {
257 L := NewState()
258 defer L.Close()
259 errorIfGFuncNotFail(t, L, func(L *LState) int {
260 deffn := L.NewFunction(func(l *LState) int { return 0 })
261 errorIfNotEqual(t, deffn, L.OptFunction(1, deffn))
262 fn := L.NewFunction(func(l *LState) int { return 0 })
263 L.Push(fn)
264 errorIfNotEqual(t, fn, L.OptFunction(2, deffn))
265 L.Push(LNumber(10))
266 L.OptFunction(3, deffn)
267 return 0
268 }, "function expected, got number")
269}
270
271func TestOptUserData(t *testing.T) {
272 L := NewState()

Callers

nothing calls this directly

Calls 8

errorIfGFuncNotFailFunction · 0.85
errorIfNotEqualFunction · 0.85
LNumberTypeAlias · 0.85
OptFunctionMethod · 0.80
NewStateFunction · 0.70
PushMethod · 0.65
CloseMethod · 0.45
NewFunctionMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…