Skip to content

Commit

Permalink
test262/harness: impl native function matcher
Browse files Browse the repository at this point in the history
test262: 55.51% (+0.11) | πŸ§ͺ 48625 | 🀠 26991 (+54) | ❌ 7363 | πŸ’€ 12943 (-54) | πŸ—οΈ 21 | πŸ’₯ 165 | ⏰ 135 | πŸ“ 1007
  • Loading branch information
CanadaHonk committed Dec 9, 2024
1 parent dfd314d commit 6acbff4
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 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.1",
"version": "0.55.2",
"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.1';
globalThis.version = '0.55.2';

// deno compat
if (typeof process === 'undefined' && typeof Deno !== 'undefined') {
Expand Down
23 changes: 22 additions & 1 deletion test262/harness.js
Original file line number Diff line number Diff line change
Expand Up @@ -1361,4 +1361,25 @@ const asyncTest = testFunc => {
}
};

// todo: assert.throwsAsync
// todo: assert.throwsAsync

/// nativeFunctionMatcher.js
const validateNativeFunctionSource = source => source.startsWith('function ') && source.endsWith('() { [native code] }');

const assertToStringOrNativeFunction = function(fn, expected) {
const actual = fn.toString();
try {
assert.sameValue(actual, expected);
} catch {
assertNativeFunction(fn, expected);
}
};

const assertNativeFunction = function(fn, special) {
const actual = fn.toString();
try {
validateNativeFunctionSource(actual);
} catch {
throw new Test262Error('assertNativeFunction failed');
}
};
2 changes: 1 addition & 1 deletion test262/history.json

Large diffs are not rendered by default.

0 comments on commit 6acbff4

Please sign in to comment.