Skip to content

Commit

Permalink
[unity]新增一个能让现有quickjs backend stackoverflow的用例
Browse files Browse the repository at this point in the history
  • Loading branch information
chexiongsheng committed Oct 30, 2024
1 parent 8ff50c8 commit 65bab10
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions unity/test/Src/Cases/ExceptionTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -404,5 +404,27 @@ function t() {
});
jsEnv.Tick();
}

[Test]
public void QuickjsStackOverflowTest()
{
var jsEnv = UnitTestEnv.GetEnv();
ConsumeStackAndCallJs(4 * 1024, jsEnv);
}

void ConsumeStackAndCallJs(int loop, JsEnv jsEnv)
{
if (loop > 0)
{
ConsumeStackAndCallJs(loop - 1, jsEnv);
}
else
{
jsEnv.Eval(@"
function foo(p) { return p;}
foo(1);
");
}
}
}
}

0 comments on commit 65bab10

Please sign in to comment.