aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2024-05-04 17:55:44 +0900
committernsfisis <nsfisis@gmail.com>2024-05-04 17:55:44 +0900
commit21dba0f4527505e7fecc0135490d277edb506dc9 (patch)
treec380d8b946b615b1ff4cde70c323ab0a8cae35d1
parent85da6235fb7b808e711c9f3f562dff246a625287 (diff)
downloadphp-waddiwasi-21dba0f4527505e7fecc0135490d277edb506dc9.tar.gz
php-waddiwasi-21dba0f4527505e7fecc0135490d277edb506dc9.tar.zst
php-waddiwasi-21dba0f4527505e7fecc0135490d277edb506dc9.zip
test: BulkTest passed
-rw-r--r--src/Execution/Runtime.php2
-rw-r--r--src/Execution/TrapKind.php1
-rw-r--r--tests/src/SpecTestsuites/SpecTestsuiteBase.php5
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,
);
}