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

Function TestPCallAfterFail

state_test.go:477–495  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

475}
476
477func TestPCallAfterFail(t *testing.T) {
478 L := NewState()
479 defer L.Close()
480 errFn := L.NewFunction(func(L *LState) int {
481 L.RaiseError("error!")
482 return 0
483 })
484 changeError := L.NewFunction(func(L *LState) int {
485 L.Push(errFn)
486 err := L.PCall(0, 0, nil)
487 if err != nil {
488 L.RaiseError("A New Error")
489 }
490 return 0
491 })
492 L.Push(changeError)
493 err := L.PCall(0, 0, nil)
494 errorIfFalse(t, strings.Contains(err.Error(), "A New Error"), "error not propogated correctly")
495}
496
497func TestRegistryFixedOverflow(t *testing.T) {
498 state := NewState()

Callers

nothing calls this directly

Calls 8

errorIfFalseFunction · 0.85
NewStateFunction · 0.70
PushMethod · 0.65
ErrorMethod · 0.65
CloseMethod · 0.45
NewFunctionMethod · 0.45
RaiseErrorMethod · 0.45
PCallMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…