diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-02-21 23:22:25 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-02-21 23:22:35 +0900 |
| commit | 39e6c4bfb1f3fb96bba47e3eec8e6451038a3d22 (patch) | |
| tree | 619472dd31a38ae277299495d0ff213e31093dfb /tests/src/SpecTestsuites | |
| parent | 2bea3784061a33870d4678af011ffc6fc73c6ad3 (diff) | |
| download | php-waddiwasi-39e6c4bfb1f3fb96bba47e3eec8e6451038a3d22.tar.gz php-waddiwasi-39e6c4bfb1f3fb96bba47e3eec8e6451038a3d22.tar.zst php-waddiwasi-39e6c4bfb1f3fb96bba47e3eec8e6451038a3d22.zip | |
Diffstat (limited to 'tests/src/SpecTestsuites')
| -rw-r--r-- | tests/src/SpecTestsuites/SpecTestsuiteBase.php | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/tests/src/SpecTestsuites/SpecTestsuiteBase.php b/tests/src/SpecTestsuites/SpecTestsuiteBase.php index 7106407..bcf7fa0 100644 --- a/tests/src/SpecTestsuites/SpecTestsuiteBase.php +++ b/tests/src/SpecTestsuites/SpecTestsuiteBase.php @@ -31,6 +31,7 @@ use Nsfisis\Waddiwasi\WebAssembly\Structure\Types\MemType; use Nsfisis\Waddiwasi\WebAssembly\Structure\Types\Mut; use Nsfisis\Waddiwasi\WebAssembly\Structure\Types\TableType; use Nsfisis\Waddiwasi\WebAssembly\Structure\Types\ValType; +use Nsfisis\Waddiwasi\WebAssembly\Validation\Validator; use PHPUnit\Framework\TestCase; use RuntimeException; use function count; @@ -157,8 +158,18 @@ abstract class SpecTestsuiteBase extends TestCase string $text, int $line, ): void { - // @todo Our implementation does not support "validation" step. - $this->assertTrue(true); + $filePath = __DIR__ . "/../../fixtures/spec_testsuites/core/{$filename}"; + $wasmBinaryStream = new FileStream($filePath); + try { + $module = (new Decoder($wasmBinaryStream))->decode(); + } catch (InvalidBinaryFormatException) { + // Malformed binary is also a form of invalid module. + $this->assertTrue(true); + return; + } + $result = (new Validator($module))->validate(); + // @todo Check error message. + $this->assertNotEmpty($result->errors, "validating {$filename} is expected to fail (at {$line})"); } protected function runAssertExhaustionCommand( |
