aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2024-07-11 02:48:53 +0900
committernsfisis <nsfisis@gmail.com>2024-07-11 02:49:10 +0900
commit326273f20c2d7dfe3d866eb720d1bb914570e3a3 (patch)
treece3d2d11eb778763587ddbcdcb12c6cf2d68cb6f /tests
parent6120682ace94e080f2113419cde93a1af6c7d89f (diff)
downloadphp-waddiwasi-326273f20c2d7dfe3d866eb720d1bb914570e3a3.tar.gz
php-waddiwasi-326273f20c2d7dfe3d866eb720d1bb914570e3a3.tar.zst
php-waddiwasi-326273f20c2d7dfe3d866eb720d1bb914570e3a3.zip
fix: test code
Diffstat (limited to 'tests')
-rw-r--r--tests/src/SpecTestsuites/SpecTestsuiteBase.php9
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/src/SpecTestsuites/SpecTestsuiteBase.php b/tests/src/SpecTestsuites/SpecTestsuiteBase.php
index 2e6234c..49ee7c0 100644
--- a/tests/src/SpecTestsuites/SpecTestsuiteBase.php
+++ b/tests/src/SpecTestsuites/SpecTestsuiteBase.php
@@ -19,6 +19,7 @@ use Nsfisis\Waddiwasi\Execution\Store;
use Nsfisis\Waddiwasi\Execution\TableInst;
use Nsfisis\Waddiwasi\Execution\TrapException;
use Nsfisis\Waddiwasi\Execution\TrapKind;
+use Nsfisis\Waddiwasi\Stream\FileStream;
use Nsfisis\Waddiwasi\Structure\Types\GlobalType;
use Nsfisis\Waddiwasi\Structure\Types\Limits;
use Nsfisis\Waddiwasi\Structure\Types\MemType;
@@ -46,8 +47,8 @@ abstract class SpecTestsuiteBase extends TestCase
): void {
$moduleName = $name ?? '_';
$filePath = __DIR__ . "/../../fixtures/spec_testsuites/core/$filename";
- $wasmBinary = file_get_contents($filePath);
- $module = (new Decoder($wasmBinary))->decode();
+ $wasmBinaryStream = new FileStream($filePath);
+ $module = (new Decoder($wasmBinaryStream))->decode();
self::$modules[$moduleName] = $module;
$importObj = [
'spectest' => [
@@ -121,10 +122,10 @@ abstract class SpecTestsuiteBase extends TestCase
int $line,
): void {
$filePath = __DIR__ . "/../../fixtures/spec_testsuites/core/$filename";
- $wasmBinary = file_get_contents($filePath);
+ $wasmBinaryStream = new FileStream($filePath);
$exception = null;
try {
- (new Decoder($wasmBinary))->decode();
+ (new Decoder($wasmBinaryStream))->decode();
} catch (InvalidBinaryFormatException $e) {
$exception = $e;
}