mirror of
https://github.com/tc39/test262.git
synced 2025-07-24 14:35:30 +02:00
Remove reportMatch
This commit is contained in:
parent
a06e66989b
commit
e778def1d1
@ -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) {
|
||||
@ -43,13 +43,6 @@ function reportCompare(...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) {
|
||||
globalThis.createIsHTMLDDA = function createIsHTMLDDA() {
|
||||
return $262.IsHTMLDDA;
|
||||
|
@ -2,52 +2,29 @@
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
includes: [sm/non262.js, sm/non262-shell.js]
|
||||
flags:
|
||||
- noStrict
|
||||
includes: [nativeFunctionMatcher.js]
|
||||
description: |
|
||||
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.
|
||||
reportMatch(nativeCode, function(){}.bind().toString());
|
||||
reportMatch(nativeCode, function fn(){}.bind().toString());
|
||||
assertNativeFunction(function(){}.bind());
|
||||
assertNativeFunction(function fn(){}.bind());
|
||||
|
||||
// Built-ins which are well-known intrinsic objects.
|
||||
reportMatch(nativeCode, Array.toString());
|
||||
reportMatch(nativeCode, Object.prototype.toString.toString());
|
||||
reportMatch(nativeCode, decodeURI.toString());
|
||||
assertNativeFunction(Array);
|
||||
assertNativeFunction(Object.prototype.toString);
|
||||
assertNativeFunction(decodeURI);
|
||||
|
||||
// Other built-in functions.
|
||||
reportMatch(nativeCode, Math.asin.toString());
|
||||
reportMatch(nativeCode, String.prototype.blink.toString());
|
||||
reportMatch(nativeCode, RegExp.prototype[Symbol.split].toString());
|
||||
assertNativeFunction(Math.asin);
|
||||
assertNativeFunction(String.prototype.blink);
|
||||
assertNativeFunction(RegExp.prototype[Symbol.split]);
|
||||
|
||||
// Built-in getter functions.
|
||||
reportMatch(nativeCode, Object.getOwnPropertyDescriptor(RegExp.prototype, "flags").get.toString());
|
||||
reportMatch(nativeCode, Object.getOwnPropertyDescriptor(Object.prototype, "__proto__").get.toString());
|
||||
assertNativeFunction(Object.getOwnPropertyDescriptor(RegExp.prototype, "flags").get);
|
||||
assertNativeFunction(Object.getOwnPropertyDescriptor(Object.prototype, "__proto__").get);
|
||||
|
||||
// Built-in setter functions.
|
||||
reportMatch(nativeCode, Object.getOwnPropertyDescriptor(Object.prototype, "__proto__").set.toString());
|
||||
assertNativeFunction(Object.getOwnPropertyDescriptor(Object.prototype, "__proto__").set);
|
||||
|
Loading…
x
Reference in New Issue
Block a user