Remove reportMatch

This commit is contained in:
André Bargull 2025-04-30 14:15:31 +02:00 committed by Ms2ger
parent a06e66989b
commit e778def1d1
2 changed files with 13 additions and 43 deletions

View File

@ -1,5 +1,5 @@
/*--- /*---
defines: [assertThrownErrorContains, assertThrowsInstanceOfWithMessageCheck, newGlobal, print, assertEq, reportCompare, reportMatch, createIsHTMLDDA, createExternalArrayBuffer] defines: [assertThrownErrorContains, assertThrowsInstanceOfWithMessageCheck, newGlobal, print, assertEq, reportCompare, createIsHTMLDDA, createExternalArrayBuffer]
---*/ ---*/
function assertThrownErrorContains(f, substr) { function assertThrownErrorContains(f, substr) {
@ -43,13 +43,6 @@ function reportCompare(...args) {
assert.sameValue(...args) assert.sameValue(...args)
} }
function reportMatch(expectedRegExp, actual, description = "") {
assert.sameValue(typeof actual, "string",
`Type mismatch, expected string, actual type ${typeof actual}`);
assert.notSameValue(expectedRegExp.exec(actual), null,
`Expected match to '${expectedRegExp}', Actual value '${actual}'`);
}
if (globalThis.createIsHTMLDDA === undefined) { if (globalThis.createIsHTMLDDA === undefined) {
globalThis.createIsHTMLDDA = function createIsHTMLDDA() { globalThis.createIsHTMLDDA = function createIsHTMLDDA() {
return $262.IsHTMLDDA; return $262.IsHTMLDDA;

View File

@ -2,52 +2,29 @@
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
includes: [sm/non262.js, sm/non262-shell.js] includes: [nativeFunctionMatcher.js]
flags:
- noStrict
description: | description: |
pending pending
esid: pending esid: pending
---*/ ---*/
// Greatly (!) simplified patterns for the PropertyName production.
var propertyName = [
// PropertyName :: LiteralPropertyName :: IdentifierName
"\\w+",
// PropertyName :: LiteralPropertyName :: StringLiteral
"(?:'[^']*')",
"(?:\"[^\"]*\")",
// PropertyName :: LiteralPropertyName :: NumericLiteral
"\\d+",
// PropertyName :: ComputedPropertyName
"(?:\\[[^\\]]+\\])",
].join("|")
var nativeCode = RegExp([
"^", "function", "(get|set)?", ("(" + propertyName + ")?"), "\\(", "\\)", "\\{", "\\[native code\\]", "\\}", "$"
].join("\\s*"));
// Bound functions are considered built-ins. // Bound functions are considered built-ins.
reportMatch(nativeCode, function(){}.bind().toString()); assertNativeFunction(function(){}.bind());
reportMatch(nativeCode, function fn(){}.bind().toString()); assertNativeFunction(function fn(){}.bind());
// Built-ins which are well-known intrinsic objects. // Built-ins which are well-known intrinsic objects.
reportMatch(nativeCode, Array.toString()); assertNativeFunction(Array);
reportMatch(nativeCode, Object.prototype.toString.toString()); assertNativeFunction(Object.prototype.toString);
reportMatch(nativeCode, decodeURI.toString()); assertNativeFunction(decodeURI);
// Other built-in functions. // Other built-in functions.
reportMatch(nativeCode, Math.asin.toString()); assertNativeFunction(Math.asin);
reportMatch(nativeCode, String.prototype.blink.toString()); assertNativeFunction(String.prototype.blink);
reportMatch(nativeCode, RegExp.prototype[Symbol.split].toString()); assertNativeFunction(RegExp.prototype[Symbol.split]);
// Built-in getter functions. // Built-in getter functions.
reportMatch(nativeCode, Object.getOwnPropertyDescriptor(RegExp.prototype, "flags").get.toString()); assertNativeFunction(Object.getOwnPropertyDescriptor(RegExp.prototype, "flags").get);
reportMatch(nativeCode, Object.getOwnPropertyDescriptor(Object.prototype, "__proto__").get.toString()); assertNativeFunction(Object.getOwnPropertyDescriptor(Object.prototype, "__proto__").get);
// Built-in setter functions. // Built-in setter functions.
reportMatch(nativeCode, Object.getOwnPropertyDescriptor(Object.prototype, "__proto__").set.toString()); assertNativeFunction(Object.getOwnPropertyDescriptor(Object.prototype, "__proto__").set);