From 21dba0f4527505e7fecc0135490d277edb506dc9 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 4 May 2024 17:55:44 +0900 Subject: test: BulkTest passed --- src/Execution/Runtime.php | 2 +- src/Execution/TrapKind.php | 1 + tests/src/SpecTestsuites/SpecTestsuiteBase.php | 5 +++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Execution/Runtime.php b/src/Execution/Runtime.php index 58e2169..5107c3d 100644 --- a/src/Execution/Runtime.php +++ b/src/Execution/Runtime.php @@ -2357,7 +2357,7 @@ final class Runtime } $r = $tab->elem[$i]; if ($r instanceof Refs\RefNull) { - throw new TrapException("call_indirect: ref.null"); + throw new TrapException("call_indirect: ref.null", trapKind: TrapKind::UninitializedElement); } assert($r instanceof Refs\RefFunc); $a = $r->addr; diff --git a/src/Execution/TrapKind.php b/src/Execution/TrapKind.php index b1c00ef..ac1c4dd 100644 --- a/src/Execution/TrapKind.php +++ b/src/Execution/TrapKind.php @@ -9,4 +9,5 @@ enum TrapKind case Unknown; case OutOfBoundsMemoryAccess; case OutOfBoundsTableAccess; + case UninitializedElement; } diff --git a/tests/src/SpecTestsuites/SpecTestsuiteBase.php b/tests/src/SpecTestsuites/SpecTestsuiteBase.php index f2b0206..d6cd85e 100644 --- a/tests/src/SpecTestsuites/SpecTestsuiteBase.php +++ b/tests/src/SpecTestsuites/SpecTestsuiteBase.php @@ -252,10 +252,11 @@ abstract class SpecTestsuiteBase extends TestCase TrapKind::Unknown => 'unknown', TrapKind::OutOfBoundsMemoryAccess => 'out of bounds memory access', TrapKind::OutOfBoundsTableAccess => 'out of bounds table access', + TrapKind::UninitializedElement => 'uninitialized element', }; - $this->assertSame( - $expectedErrorMessage, + $this->assertStringContainsString( $actualErrorMessage, + $expectedErrorMessage, 'trap kind mismatch' . $message, ); } -- cgit v1.2.3-70-g09d2