(t *testing.T)
| 14 | } |
| 15 | |
| 16 | func 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 | |
| 42 | func TestCallStackOverflowWhenAutoGrow(t *testing.T) { |
| 43 | L := NewState(Options{ |
nothing calls this directly
no test coverage detected
searching dependent graphs…