From 27cd7cf8f816f1d1dd465c28a43fc0fcd25c48d6 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 5 May 2024 12:27:17 +0900 Subject: feat: limit call stack size --- tests/src/SpecTestsuites/SpecTestsuiteBase.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'tests/src/SpecTestsuites/SpecTestsuiteBase.php') diff --git a/tests/src/SpecTestsuites/SpecTestsuiteBase.php b/tests/src/SpecTestsuites/SpecTestsuiteBase.php index cd5da89..eca3b5c 100644 --- a/tests/src/SpecTestsuites/SpecTestsuiteBase.php +++ b/tests/src/SpecTestsuites/SpecTestsuiteBase.php @@ -9,6 +9,7 @@ use Nsfisis\Waddiwasi\BinaryFormat\InvalidBinaryFormatException; use Nsfisis\Waddiwasi\Execution\Ref; use Nsfisis\Waddiwasi\Execution\Refs\RefExtern; use Nsfisis\Waddiwasi\Execution\Runtime; +use Nsfisis\Waddiwasi\Execution\StackOverflowException; use Nsfisis\Waddiwasi\Execution\Store; use Nsfisis\Waddiwasi\Execution\TrapException; use Nsfisis\Waddiwasi\Execution\TrapKind; @@ -95,11 +96,19 @@ abstract class SpecTestsuiteBase extends TestCase } protected function runAssertExhaustionCommand( + ?string $module, array $action, string $text, int $line, ): void { - $this->assertTrue(false, "assert_exhaustion"); + $exception = null; + try { + $this->doAction($module, $action); + } catch (StackOverflowException $e) { + $exception = $e; + } + $this->assertNotNull($exception, "at $line"); + // @todo Check $text? } protected function runAssertUninstantiableCommand( -- cgit v1.2.3-70-g09d2