Skip to content

Commit

Permalink
test262/harness: refine sm
Browse files Browse the repository at this point in the history
test262: 55.10% | πŸ§ͺ 50255 | 🀠 27692 (-1) | ❌ 7210 (+1) | πŸ’€ 14003 (+1) | πŸ—οΈ 32 | πŸ’₯ 179 (-3) | ⏰ 140 | πŸ“ 999 (+2)
  • Loading branch information
CanadaHonk committed Dec 14, 2024
1 parent c06fd49 commit d5bef1e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 44 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "porffor",
"description": "a basic experimental wip aot optimizing js -> wasm engine/compiler/runtime in js",
"version": "0.55.3",
"version": "0.55.4",
"author": "CanadaHonk",
"license": "MIT",
"scripts": {},
Expand Down
2 changes: 1 addition & 1 deletion runner/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env node
import fs from 'node:fs';
globalThis.version = '0.55.3';
globalThis.version = '0.55.4';

// deno compat
if (typeof process === 'undefined' && typeof Deno !== 'undefined') {
Expand Down
53 changes: 12 additions & 41 deletions test262/harness.js
Original file line number Diff line number Diff line change
Expand Up @@ -1391,7 +1391,7 @@ function inSection() {}
function printStatus() {}
function writeHeaderToLog() {}

function assertThrownErrorContains(f, substr) {
function assertThrownErrorContains(f) {
try {
f();
} catch {
Expand All @@ -1401,23 +1401,15 @@ function assertThrownErrorContains(f, substr) {
throw new Test262Error("Expected error no exception thrown");
}

function assertThrowsInstanceOfWithMessageCheck(f, ctor, _check, msg) {
var fullmsg;
function assertThrowsInstanceOfWithMessageCheck(f, ctor) {
try {
f();
} catch (exc) {
if (exc instanceof ctor)
return;
fullmsg = `Assertion failed: expected exception ${ctor.name}, got ${exc}`;
if (exc instanceof ctor) return;
}

if (fullmsg === undefined)
fullmsg = `Assertion failed: expected exception ${ctor.name}, no exception thrown`;
if (msg !== undefined)
fullmsg += " - " + msg;

throw new Error(fullmsg);
}
throw new Error('assertThrowsInstanceOfWithMessageCheck failed');
};

function assertEq(a, b) {
assert.sameValue(a, b);
Expand Down Expand Up @@ -1466,7 +1458,7 @@ function deepEqual(a, b) {
return a !== a && b !== b;
}

function assertThrowsValue(f, val, msg) {
function assertThrowsValue(f, val) {
var fullmsg;
try {
f();
Expand All @@ -1478,35 +1470,14 @@ function assertThrowsValue(f, val, msg) {
throw new Error('assertThrowsValue failed');
};

function assertThrownErrorContains(thunk, substr) {
try {
thunk();
} catch {
return;
}

throw new Error("Expected error no exception thrown");
};

function assertThrowsInstanceOfWithMessageCheck(f, ctor, check, msg) {
var fullmsg;
try {
f();
} catch (exc) {
if (exc instanceof ctor) return;
}

throw new Error('assertThrowsInstanceOfWithMessageCheck failed');
};

function assertThrowsInstanceOf(f, ctor, msg) {
assertThrowsInstanceOfWithMessageCheck(f, ctor, _ => true, msg);
function assertThrowsInstanceOf(f, ctor) {
assertThrowsInstanceOfWithMessageCheck(f, ctor);
};

function assertThrowsInstanceOfWithMessage(f, ctor, expected, msg) {
assertThrowsInstanceOfWithMessageCheck(f, ctor, message => message === expected, msg);
function assertThrowsInstanceOfWithMessage(f, ctor) {
assertThrowsInstanceOfWithMessageCheck(f, ctor);
}

function assertThrowsInstanceOfWithMessageContains(f, ctor, substr, msg) {
assertThrowsInstanceOfWithMessageCheck(f, ctor, message => message.indexOf(substr) !== -1, msg);
function assertThrowsInstanceOfWithMessageContains(f, ctor) {
assertThrowsInstanceOfWithMessageCheck(f, ctor);
}
2 changes: 1 addition & 1 deletion test262/history.json

Large diffs are not rendered by default.

0 comments on commit d5bef1e

Please sign in to comment.