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

Function TestCallStackOverflowWhenFixed

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

Source from the content-addressed store, hash-verified

14}
15
16func TestCallStackOverflowWhenFixed(t *testing.T) {
17 L := NewState(Options{
18 CallStackSize: 3,
19 })
20 defer L.Close()
21
22 // expect fixed stack implementation by default (for backwards compatibility)
23 stack := L.stack
24 if _, ok := stack.(*fixedCallFrameStack); !ok {
25 t.Errorf("expected fixed callframe stack by default")
26 }
27
28 errorIfScriptNotFail(t, L, `
29 local function recurse(count)
30 if count > 0 then
31 recurse(count - 1)
32 end
33 end
34 local function c()
35 print(_printregs())
36 recurse(9)
37 end
38 c()
39 `, "stack overflow")
40}
41
42func TestCallStackOverflowWhenAutoGrow(t *testing.T) {
43 L := NewState(Options{

Callers

nothing calls this directly

Calls 3

errorIfScriptNotFailFunction · 0.85
NewStateFunction · 0.70
CloseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…