From 83ffb4bbf2a7a2f68075c8e611525b55ea5cfecc Mon Sep 17 00:00:00 2001
From: Michael Ficarra <mficarra@shapesecurity.com>
Date: Tue, 6 Mar 2018 18:18:00 -0800
Subject: [PATCH] allow any function to report its toString as a NativeFunction

related: https://github.com/tc39/Function-prototype-toString-revision/pull/26
---
 harness/nativeFunctionMatcher.js                   | 14 ++++++++++++++
 .../Function/prototype/toString/AsyncFunction.js   |  3 ++-
 .../Function/prototype/toString/AsyncGenerator.js  |  3 ++-
 .../Function/prototype/toString/Function.js        |  3 ++-
 .../prototype/toString/GeneratorFunction.js        |  3 ++-
 .../Function/prototype/toString/arrow-function.js  |  7 ++++---
 .../prototype/toString/async-arrow-function.js     |  7 ++++---
 .../toString/async-function-declaration.js         |  3 ++-
 .../toString/async-function-expression.js          |  5 +++--
 .../toString/async-generator-declaration.js        |  3 ++-
 .../toString/async-generator-expression.js         |  5 +++--
 ...ync-generator-method-class-expression-static.js |  7 ++++---
 .../async-generator-method-class-expression.js     |  7 ++++---
 ...sync-generator-method-class-statement-static.js |  7 ++++---
 .../async-generator-method-class-statement.js      |  7 ++++---
 .../toString/async-generator-method-object.js      |  7 ++++---
 .../async-method-class-expression-static.js        |  7 ++++---
 .../toString/async-method-class-expression.js      |  7 ++++---
 .../async-method-class-statement-static.js         |  7 ++++---
 .../toString/async-method-class-statement.js       |  7 ++++---
 .../prototype/toString/async-method-object.js      |  7 ++++---
 .../Function/prototype/toString/bound-function.js  |  2 +-
 .../toString/class-declaration-complex-heritage.js |  3 ++-
 .../toString/class-declaration-explicit-ctor.js    |  3 ++-
 .../toString/class-declaration-implicit-ctor.js    |  7 ++++---
 .../toString/class-expression-explicit-ctor.js     |  3 ++-
 .../toString/class-expression-implicit-ctor.js     |  7 ++++---
 ...nction-declaration-non-simple-parameter-list.js |  3 ++-
 .../prototype/toString/function-declaration.js     |  3 ++-
 .../prototype/toString/function-expression.js      |  5 +++--
 .../toString/generator-function-declaration.js     |  3 ++-
 .../toString/generator-function-expression.js      |  5 +++--
 .../prototype/toString/generator-method.js         |  7 ++++---
 .../toString/getter-class-expression-static.js     |  7 ++++---
 .../prototype/toString/getter-class-expression.js  |  7 ++++---
 .../toString/getter-class-statement-static.js      |  7 ++++---
 .../prototype/toString/getter-class-statement.js   |  7 ++++---
 .../Function/prototype/toString/getter-object.js   |  7 ++++---
 .../Function/prototype/toString/intrinsics.js      |  2 +-
 .../line-terminator-normalisation-CR-LF.js         |  3 ++-
 .../toString/line-terminator-normalisation-CR.js   |  2 +-
 .../toString/line-terminator-normalisation-LF.js   |  3 ++-
 .../toString/method-class-expression-static.js     |  7 ++++---
 .../prototype/toString/method-class-expression.js  |  7 ++++---
 .../toString/method-class-statement-static.js      |  7 ++++---
 .../prototype/toString/method-class-statement.js   |  7 ++++---
 .../toString/method-computed-property-name.js      |  5 +++--
 .../Function/prototype/toString/method-object.js   |  3 ++-
 .../toString/setter-class-expression-static.js     |  7 ++++---
 .../prototype/toString/setter-class-expression.js  |  7 ++++---
 .../toString/setter-class-statement-static.js      |  7 ++++---
 .../prototype/toString/setter-class-statement.js   |  7 ++++---
 .../Function/prototype/toString/setter-object.js   |  7 ++++---
 .../Function/prototype/toString/unicode.js         |  3 ++-
 54 files changed, 180 insertions(+), 116 deletions(-)

diff --git a/harness/nativeFunctionMatcher.js b/harness/nativeFunctionMatcher.js
index 0a2d248a35..52120ea48e 100644
--- a/harness/nativeFunctionMatcher.js
+++ b/harness/nativeFunctionMatcher.js
@@ -6,3 +6,17 @@ description: |
     the NativeFunction grammar production without requiring a correct tokeniser.
 ---*/
 const NATIVE_FUNCTION_RE = /\bfunction\b[\s\S]*\([\s\S]*\)[\s\S]*\{[\s\S]*\[[\s\S]*\bnative\b[\s\S]+\bcode\b[\s\S]*\][\s\S]*\}/;
+
+const assertToStringOrNativeFunction = function(fn, expected) {
+  const actual = "" + fn;
+  try {
+    assert.sameValue(actual, expected);
+  } catch (unused) {
+    assertNativeFunction(fn);
+  }
+};
+
+const assertNativeFunction = function(fn) {
+  const actual = "" + fn;
+  assert(NATIVE_FUNCTION_RE.test(actual), "looks pretty much like a NativeFunction");
+};
diff --git a/test/built-ins/Function/prototype/toString/AsyncFunction.js b/test/built-ins/Function/prototype/toString/AsyncFunction.js
index 23af1aa499..3a8148fdf7 100644
--- a/test/built-ins/Function/prototype/toString/AsyncFunction.js
+++ b/test/built-ins/Function/prototype/toString/AsyncFunction.js
@@ -8,8 +8,9 @@ description: >
   Function.prototype.toString on an async function created with the
   AsyncFunction constructor.
 features: [async-functions]
+includes: [nativeFunctionMatcher.js]
 ---*/
 async function f() {}
 var AsyncFunction = f.constructor;
 var g = /* before */AsyncFunction("a", " /* a */ b, c /* b */ //", "/* c */ ; /* d */ //")/* after */; 
-assert.sameValue(g.toString(), "async function anonymous(a, /* a */ b, c /* b */ //\n) {\n/* c */ ; /* d */ //\n}");
+assertToStringOrNativeFunction(g, "async function anonymous(a, /* a */ b, c /* b */ //\n) {\n/* c */ ; /* d */ //\n}");
diff --git a/test/built-ins/Function/prototype/toString/AsyncGenerator.js b/test/built-ins/Function/prototype/toString/AsyncGenerator.js
index f5acf57611..47a857a7d2 100644
--- a/test/built-ins/Function/prototype/toString/AsyncGenerator.js
+++ b/test/built-ins/Function/prototype/toString/AsyncGenerator.js
@@ -7,10 +7,11 @@ description: >
   Function.prototype.toString on an async generator created with the
   AsyncGenerator constructor.
 features: [async-iteration]
+includes: [nativeFunctionMatcher.js]
 ---*/
 
 async function* f() {}
 var AsyncGenerator = f.constructor;
 
 var g = /* before */AsyncGenerator("a", " /* a */ b, c /* b */ //", "/* c */ ; /* d */ //")/* after */;
-assert.sameValue(g.toString(), "async function* anonymous(a, /* a */ b, c /* b */ //\n) {\n/* c */ ; /* d */ //\n}");
+assertToStringOrNativeFunction(g, "async function* anonymous(a, /* a */ b, c /* b */ //\n) {\n/* c */ ; /* d */ //\n}");
diff --git a/test/built-ins/Function/prototype/toString/Function.js b/test/built-ins/Function/prototype/toString/Function.js
index 2f0362a8d8..a619787cc5 100644
--- a/test/built-ins/Function/prototype/toString/Function.js
+++ b/test/built-ins/Function/prototype/toString/Function.js
@@ -4,8 +4,9 @@
 /*---
 esid: sec-createdynamicfunction
 description: Function.prototype.toString on a function created with the Function constructor
+includes: [nativeFunctionMatcher.js]
 ---*/
 
 let f = /* before */Function("a", " /* a */ b, c /* b */ //", "/* c */ ; /* d */ //")/* after */;
 
-assert.sameValue(f.toString(), "function anonymous(a, /* a */ b, c /* b */ //\n) {\n/* c */ ; /* d */ //\n}");
+assertToStringOrNativeFunction(f, "function anonymous(a, /* a */ b, c /* b */ //\n) {\n/* c */ ; /* d */ //\n}");
diff --git a/test/built-ins/Function/prototype/toString/GeneratorFunction.js b/test/built-ins/Function/prototype/toString/GeneratorFunction.js
index 523f1cd2a7..83e54b98a1 100644
--- a/test/built-ins/Function/prototype/toString/GeneratorFunction.js
+++ b/test/built-ins/Function/prototype/toString/GeneratorFunction.js
@@ -5,9 +5,10 @@
 esid: sec-createdynamicfunction
 description: Function.prototype.toString on a generator function created with the GeneratorFunction constructor
 features: [generators]
+includes: [nativeFunctionMatcher.js]
 ---*/
 
 let GeneratorFunction = Object.getPrototypeOf(function*(){}).constructor;
 let g = /* before */GeneratorFunction("a", " /* a */ b, c /* b */ //", "/* c */ yield yield; /* d */ //")/* after */;
 
-assert.sameValue(g.toString(), "function* anonymous(a, /* a */ b, c /* b */ //\n) {\n/* c */ yield yield; /* d */ //\n}");
+assertToStringOrNativeFunction(g, "function* anonymous(a, /* a */ b, c /* b */ //\n) {\n/* c */ yield yield; /* d */ //\n}");
diff --git a/test/built-ins/Function/prototype/toString/arrow-function.js b/test/built-ins/Function/prototype/toString/arrow-function.js
index 06990b14c5..897ea45b25 100644
--- a/test/built-ins/Function/prototype/toString/arrow-function.js
+++ b/test/built-ins/Function/prototype/toString/arrow-function.js
@@ -4,12 +4,13 @@
 /*---
 esid: sec-arrow-function-definitions-runtime-semantics-evaluation
 description: Function.prototype.toString on an arrow function
+includes: [nativeFunctionMatcher.js]
 ---*/
 
 let f = /* before */( /* a */ a /* b */ , /* c */ b /* d */ ) /* e */ => /* f */ { /* g */ ; /* h */ }/* after */;
 let g = /* before */( /* a */ ) /* b */ => /* c */ 0/* after */;
 let h = /* before */a /* a */ => /* b */ 0/* after */;
 
-assert.sameValue(f.toString(), "( /* a */ a /* b */ , /* c */ b /* d */ ) /* e */ => /* f */ { /* g */ ; /* h */ }");
-assert.sameValue(g.toString(), "( /* a */ ) /* b */ => /* c */ 0");
-assert.sameValue(h.toString(), "a /* a */ => /* b */ 0");
+assertToStringOrNativeFunction(f, "( /* a */ a /* b */ , /* c */ b /* d */ ) /* e */ => /* f */ { /* g */ ; /* h */ }");
+assertToStringOrNativeFunction(g, "( /* a */ ) /* b */ => /* c */ 0");
+assertToStringOrNativeFunction(h, "a /* a */ => /* b */ 0");
diff --git a/test/built-ins/Function/prototype/toString/async-arrow-function.js b/test/built-ins/Function/prototype/toString/async-arrow-function.js
index 39a2a03886..ee534f0b6b 100644
--- a/test/built-ins/Function/prototype/toString/async-arrow-function.js
+++ b/test/built-ins/Function/prototype/toString/async-arrow-function.js
@@ -5,12 +5,13 @@
 esid: sec-async-arrow-function-definitions-runtime-semantics-evaluation
 description: Function.prototype.toString on an async arrow function
 features: [async-functions]
+includes: [nativeFunctionMatcher.js]
 ---*/
 
 let f = /* before */async /* a */ ( /* b */ a /* c */ , /* d */ b /* e */ ) /* f */ => /* g */ { /* h */ ; /* i */ }/* after */;
 let g = /* before */async /* a */ ( /* b */ ) /* c */ => /* d */ 0/* after */;
 let h = /* before */async /* a */ a /* b */ => /* c */ 0/* after */;
 
-assert.sameValue(f.toString(), "async /* a */ ( /* b */ a /* c */ , /* d */ b /* e */ ) /* f */ => /* g */ { /* h */ ; /* i */ }");
-assert.sameValue(g.toString(), "async /* a */ ( /* b */ ) /* c */ => /* d */ 0");
-assert.sameValue(h.toString(), "async /* a */ a /* b */ => /* c */ 0");
+assertToStringOrNativeFunction(f, "async /* a */ ( /* b */ a /* c */ , /* d */ b /* e */ ) /* f */ => /* g */ { /* h */ ; /* i */ }");
+assertToStringOrNativeFunction(g, "async /* a */ ( /* b */ ) /* c */ => /* d */ 0");
+assertToStringOrNativeFunction(h, "async /* a */ a /* b */ => /* c */ 0");
diff --git a/test/built-ins/Function/prototype/toString/async-function-declaration.js b/test/built-ins/Function/prototype/toString/async-function-declaration.js
index 0bc6c5500c..168efa0124 100644
--- a/test/built-ins/Function/prototype/toString/async-function-declaration.js
+++ b/test/built-ins/Function/prototype/toString/async-function-declaration.js
@@ -6,8 +6,9 @@ author: Brian Terlson <brian.terlson@microsoft.com>
 esid: sec-function.prototype.tostring
 description: Function.prototype.toString on an async function declaration
 features: [async-functions]
+includes: [nativeFunctionMatcher.js]
 ---*/
 
 /* before */async function /* a */ f /* b */ ( /* c */ x /* d */ , /* e */ y /* f */ ) /* g */ { /* h */ ; /* i */ ; /* j */ }/* after */
 
-assert.sameValue(f.toString(), "async function /* a */ f /* b */ ( /* c */ x /* d */ , /* e */ y /* f */ ) /* g */ { /* h */ ; /* i */ ; /* j */ }");
+assertToStringOrNativeFunction(f, "async function /* a */ f /* b */ ( /* c */ x /* d */ , /* e */ y /* f */ ) /* g */ { /* h */ ; /* i */ ; /* j */ }");
diff --git a/test/built-ins/Function/prototype/toString/async-function-expression.js b/test/built-ins/Function/prototype/toString/async-function-expression.js
index 2b540b4e87..d9878ea5db 100644
--- a/test/built-ins/Function/prototype/toString/async-function-expression.js
+++ b/test/built-ins/Function/prototype/toString/async-function-expression.js
@@ -6,10 +6,11 @@ author: Brian Terlson <brian.terlson@microsoft.com>
 esid: sec-function.prototype.tostring
 description: Function.prototype.toString on an async function expression
 features: [async-functions]
+includes: [nativeFunctionMatcher.js]
 ---*/
 
 let f = /* before */async function /* a */ F /* b */ ( /* c */ x /* d */ , /* e */ y /* f */ ) /* g */ { /* h */ ; /* i */ ; /* j */ }/* after */;
 let g = /* before */async function /* a */ ( /* b */ x /* c */ , /* d */ y /* e */ ) /* f */ { /* g */ ; /* h */ ; /* i */ }/* after */;
 
-assert.sameValue(f.toString(), "async function /* a */ F /* b */ ( /* c */ x /* d */ , /* e */ y /* f */ ) /* g */ { /* h */ ; /* i */ ; /* j */ }");
-assert.sameValue(g.toString(), "async function /* a */ ( /* b */ x /* c */ , /* d */ y /* e */ ) /* f */ { /* g */ ; /* h */ ; /* i */ }");
+assertToStringOrNativeFunction(f, "async function /* a */ F /* b */ ( /* c */ x /* d */ , /* e */ y /* f */ ) /* g */ { /* h */ ; /* i */ ; /* j */ }");
+assertToStringOrNativeFunction(g, "async function /* a */ ( /* b */ x /* c */ , /* d */ y /* e */ ) /* f */ { /* g */ ; /* h */ ; /* i */ }");
diff --git a/test/built-ins/Function/prototype/toString/async-generator-declaration.js b/test/built-ins/Function/prototype/toString/async-generator-declaration.js
index 49374185e5..ffb583cb53 100644
--- a/test/built-ins/Function/prototype/toString/async-generator-declaration.js
+++ b/test/built-ins/Function/prototype/toString/async-generator-declaration.js
@@ -5,8 +5,9 @@
 esid: sec-function.prototype.tostring
 description: Function.prototype.toString on an async generator declaration
 features: [async-iteration]
+includes: [nativeFunctionMatcher.js]
 ---*/
 
 /* before */async /* a */ function /* b */ * /* c */ f /* d */ ( /* e */ x /* f */ , /* g */ y /* h */ ) /* i */ { /* j */ ; /* k */ ; /* l */ }/* after */
 
-assert.sameValue(f.toString(), "async /* a */ function /* b */ * /* c */ f /* d */ ( /* e */ x /* f */ , /* g */ y /* h */ ) /* i */ { /* j */ ; /* k */ ; /* l */ }");
+assertToStringOrNativeFunction(f, "async /* a */ function /* b */ * /* c */ f /* d */ ( /* e */ x /* f */ , /* g */ y /* h */ ) /* i */ { /* j */ ; /* k */ ; /* l */ }");
diff --git a/test/built-ins/Function/prototype/toString/async-generator-expression.js b/test/built-ins/Function/prototype/toString/async-generator-expression.js
index f7c3bdf93e..6b8ed26135 100644
--- a/test/built-ins/Function/prototype/toString/async-generator-expression.js
+++ b/test/built-ins/Function/prototype/toString/async-generator-expression.js
@@ -5,10 +5,11 @@
 esid: sec-function.prototype.tostring
 description: Function.prototype.toString on an async generator expression
 features: [async-iteration]
+includes: [nativeFunctionMatcher.js]
 ---*/
 
 let f = /* before */async /* a */ function /* b */ * /* c */ F /* d */ ( /* e */ x /* f */ , /* g */ y /* h */ ) /* i */ { /* j */ ; /* k */ ; /* l */ }/* after */;
 let g = /* before */async /* a */ function /* b */ * /* c */ ( /* d */ x /* e */ , /* f */ y /* g */ ) /* h */ { /* i */ ; /* j */ ; /* k */ }/* after */;
 
-assert.sameValue(f.toString(), "async /* a */ function /* b */ * /* c */ F /* d */ ( /* e */ x /* f */ , /* g */ y /* h */ ) /* i */ { /* j */ ; /* k */ ; /* l */ }");
-assert.sameValue(g.toString(), "async /* a */ function /* b */ * /* c */ ( /* d */ x /* e */ , /* f */ y /* g */ ) /* h */ { /* i */ ; /* j */ ; /* k */ }");
+assertToStringOrNativeFunction(f, "async /* a */ function /* b */ * /* c */ F /* d */ ( /* e */ x /* f */ , /* g */ y /* h */ ) /* i */ { /* j */ ; /* k */ ; /* l */ }");
+assertToStringOrNativeFunction(g, "async /* a */ function /* b */ * /* c */ ( /* d */ x /* e */ , /* f */ y /* g */ ) /* h */ { /* i */ ; /* j */ ; /* k */ }");
diff --git a/test/built-ins/Function/prototype/toString/async-generator-method-class-expression-static.js b/test/built-ins/Function/prototype/toString/async-generator-method-class-expression-static.js
index 27f90e29d1..16428b38fa 100644
--- a/test/built-ins/Function/prototype/toString/async-generator-method-class-expression-static.js
+++ b/test/built-ins/Function/prototype/toString/async-generator-method-class-expression-static.js
@@ -5,6 +5,7 @@
 esid: sec-function.prototype.tostring
 description: Function.prototype.toString on an async generator method
 features: [async-iteration]
+includes: [nativeFunctionMatcher.js]
 ---*/
 
 let x = "h";
@@ -12,6 +13,6 @@ let f = class { static /* before */async /* a */ * /* b */ f /* c */ ( /* d */ )
 let g = class { static /* before */async /* a */ * /* b */ [ /* c */ "g" /* d */ ] /* e */ ( /* f */ ) /* g */ { /* h */ }/* after */ }.g;
 let h = class { static /* before */async /* a */ * /* b */ [ /* c */ x /* d */ ] /* e */ ( /* f */ ) /* g */ { /* h */ }/* after */ }.h;
 
-assert.sameValue(f.toString(), "async /* a */ * /* b */ f /* c */ ( /* d */ ) /* e */ { /* f */ }");
-assert.sameValue(g.toString(), "async /* a */ * /* b */ [ /* c */ \"g\" /* d */ ] /* e */ ( /* f */ ) /* g */ { /* h */ }");
-assert.sameValue(h.toString(), "async /* a */ * /* b */ [ /* c */ x /* d */ ] /* e */ ( /* f */ ) /* g */ { /* h */ }");
+assertToStringOrNativeFunction(f, "async /* a */ * /* b */ f /* c */ ( /* d */ ) /* e */ { /* f */ }");
+assertToStringOrNativeFunction(g, "async /* a */ * /* b */ [ /* c */ \"g\" /* d */ ] /* e */ ( /* f */ ) /* g */ { /* h */ }");
+assertToStringOrNativeFunction(h, "async /* a */ * /* b */ [ /* c */ x /* d */ ] /* e */ ( /* f */ ) /* g */ { /* h */ }");
diff --git a/test/built-ins/Function/prototype/toString/async-generator-method-class-expression.js b/test/built-ins/Function/prototype/toString/async-generator-method-class-expression.js
index fae7a4ee75..e9b00710f1 100644
--- a/test/built-ins/Function/prototype/toString/async-generator-method-class-expression.js
+++ b/test/built-ins/Function/prototype/toString/async-generator-method-class-expression.js
@@ -5,6 +5,7 @@
 esid: sec-function.prototype.tostring
 description: Function.prototype.toString on an async generator method
 features: [async-iteration]
+includes: [nativeFunctionMatcher.js]
 ---*/
 
 let x = "h";
@@ -12,6 +13,6 @@ let f = class { /* before */async /* a */ * /* b */ f /* c */ ( /* d */ ) /* e *
 let g = class { /* before */async /* a */ * /* b */ [ /* c */ "g" /* d */ ] /* e */ ( /* f */ ) /* g */ { /* h */ }/* after */ }.prototype.g;
 let h = class { /* before */async /* a */ * /* b */ [ /* c */ x /* d */ ] /* e */ ( /* f */ ) /* g */ { /* h */ }/* after */ }.prototype.h;
 
-assert.sameValue(f.toString(), "async /* a */ * /* b */ f /* c */ ( /* d */ ) /* e */ { /* f */ }");
-assert.sameValue(g.toString(), "async /* a */ * /* b */ [ /* c */ \"g\" /* d */ ] /* e */ ( /* f */ ) /* g */ { /* h */ }");
-assert.sameValue(h.toString(), "async /* a */ * /* b */ [ /* c */ x /* d */ ] /* e */ ( /* f */ ) /* g */ { /* h */ }");
+assertToStringOrNativeFunction(f, "async /* a */ * /* b */ f /* c */ ( /* d */ ) /* e */ { /* f */ }");
+assertToStringOrNativeFunction(g, "async /* a */ * /* b */ [ /* c */ \"g\" /* d */ ] /* e */ ( /* f */ ) /* g */ { /* h */ }");
+assertToStringOrNativeFunction(h, "async /* a */ * /* b */ [ /* c */ x /* d */ ] /* e */ ( /* f */ ) /* g */ { /* h */ }");
diff --git a/test/built-ins/Function/prototype/toString/async-generator-method-class-statement-static.js b/test/built-ins/Function/prototype/toString/async-generator-method-class-statement-static.js
index 5a4294c18a..8ada3fe1e9 100644
--- a/test/built-ins/Function/prototype/toString/async-generator-method-class-statement-static.js
+++ b/test/built-ins/Function/prototype/toString/async-generator-method-class-statement-static.js
@@ -5,6 +5,7 @@
 esid: sec-function.prototype.tostring
 description: Function.prototype.toString on an async generator method
 features: [async-iteration]
+includes: [nativeFunctionMatcher.js]
 ---*/
 
 let x = "h";
@@ -16,6 +17,6 @@ let f = F.f;
 let g = G.g;
 let h = H.h;
 
-assert.sameValue(f.toString(), "async /* a */ * /* b */ f /* c */ ( /* d */ ) /* e */ { /* f */ }");
-assert.sameValue(g.toString(), "async /* a */ * /* b */ [ /* c */ \"g\" /* d */ ] /* e */ ( /* f */ ) /* g */ { /* h */ }");
-assert.sameValue(h.toString(), "async /* a */ * /* b */ [ /* c */ x /* d */ ] /* e */ ( /* f */ ) /* g */ { /* h */ }");
+assertToStringOrNativeFunction(f, "async /* a */ * /* b */ f /* c */ ( /* d */ ) /* e */ { /* f */ }");
+assertToStringOrNativeFunction(g, "async /* a */ * /* b */ [ /* c */ \"g\" /* d */ ] /* e */ ( /* f */ ) /* g */ { /* h */ }");
+assertToStringOrNativeFunction(h, "async /* a */ * /* b */ [ /* c */ x /* d */ ] /* e */ ( /* f */ ) /* g */ { /* h */ }");
diff --git a/test/built-ins/Function/prototype/toString/async-generator-method-class-statement.js b/test/built-ins/Function/prototype/toString/async-generator-method-class-statement.js
index 8160bd4dd6..0ee3ffc0e3 100644
--- a/test/built-ins/Function/prototype/toString/async-generator-method-class-statement.js
+++ b/test/built-ins/Function/prototype/toString/async-generator-method-class-statement.js
@@ -5,6 +5,7 @@
 esid: sec-function.prototype.tostring
 description: Function.prototype.toString on an async generator method
 features: [async-iteration]
+includes: [nativeFunctionMatcher.js]
 ---*/
 
 let x = "h";
@@ -16,6 +17,6 @@ let f = F.prototype.f;
 let g = G.prototype.g;
 let h = H.prototype.h;
 
-assert.sameValue(f.toString(), "async /* a */ * /* b */ f /* c */ ( /* d */ ) /* e */ { /* f */ }");
-assert.sameValue(g.toString(), "async /* a */ * /* b */ [ /* c */ \"g\" /* d */ ] /* e */ ( /* f */ ) /* g */ { /* h */ }");
-assert.sameValue(h.toString(), "async /* a */ * /* b */ [ /* c */ x /* d */ ] /* e */ ( /* f */ ) /* g */ { /* h */ }");
+assertToStringOrNativeFunction(f, "async /* a */ * /* b */ f /* c */ ( /* d */ ) /* e */ { /* f */ }");
+assertToStringOrNativeFunction(g, "async /* a */ * /* b */ [ /* c */ \"g\" /* d */ ] /* e */ ( /* f */ ) /* g */ { /* h */ }");
+assertToStringOrNativeFunction(h, "async /* a */ * /* b */ [ /* c */ x /* d */ ] /* e */ ( /* f */ ) /* g */ { /* h */ }");
diff --git a/test/built-ins/Function/prototype/toString/async-generator-method-object.js b/test/built-ins/Function/prototype/toString/async-generator-method-object.js
index ef8fbb9e47..826538b87c 100644
--- a/test/built-ins/Function/prototype/toString/async-generator-method-object.js
+++ b/test/built-ins/Function/prototype/toString/async-generator-method-object.js
@@ -5,6 +5,7 @@
 esid: sec-function.prototype.tostring
 description: Function.prototype.toString on an async generator method
 features: [async-iteration]
+includes: [nativeFunctionMatcher.js]
 ---*/
 
 let x = "h";
@@ -12,6 +13,6 @@ let f = { /* before */async /* a */ * /* b */ f /* c */ ( /* d */ ) /* e */ { /*
 let g = { /* before */async /* a */ * /* b */ [ /* c */ "g" /* d */ ] /* e */ ( /* f */ ) /* g */ { /* h */ }/* after */ }.g;
 let h = { /* before */async /* a */ * /* b */ [ /* c */ x /* d */ ] /* e */ ( /* f */ ) /* g */ { /* h */ }/* after */ }.h;
 
-assert.sameValue(f.toString(), "async /* a */ * /* b */ f /* c */ ( /* d */ ) /* e */ { /* f */ }");
-assert.sameValue(g.toString(), "async /* a */ * /* b */ [ /* c */ \"g\" /* d */ ] /* e */ ( /* f */ ) /* g */ { /* h */ }");
-assert.sameValue(h.toString(), "async /* a */ * /* b */ [ /* c */ x /* d */ ] /* e */ ( /* f */ ) /* g */ { /* h */ }");
+assertToStringOrNativeFunction(f, "async /* a */ * /* b */ f /* c */ ( /* d */ ) /* e */ { /* f */ }");
+assertToStringOrNativeFunction(g, "async /* a */ * /* b */ [ /* c */ \"g\" /* d */ ] /* e */ ( /* f */ ) /* g */ { /* h */ }");
+assertToStringOrNativeFunction(h, "async /* a */ * /* b */ [ /* c */ x /* d */ ] /* e */ ( /* f */ ) /* g */ { /* h */ }");
diff --git a/test/built-ins/Function/prototype/toString/async-method-class-expression-static.js b/test/built-ins/Function/prototype/toString/async-method-class-expression-static.js
index c3604bbefb..ba319409f2 100644
--- a/test/built-ins/Function/prototype/toString/async-method-class-expression-static.js
+++ b/test/built-ins/Function/prototype/toString/async-method-class-expression-static.js
@@ -5,6 +5,7 @@
 esid: sec-function.prototype.tostring
 description: Function.prototype.toString on an async method
 features: [async-functions]
+includes: [nativeFunctionMatcher.js]
 ---*/
 
 let x = "h";
@@ -12,6 +13,6 @@ let f = class { static /* before */async f /* a */ ( /* b */ ) /* c */ { /* d */
 let g = class { static /* before */async /* a */ [ /* b */ "g" /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }/* after */ }.g;
 let h = class { static /* before */async /* a */ [ /* b */ x /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }/* after */ }.h;
 
-assert.sameValue(f.toString(), "async f /* a */ ( /* b */ ) /* c */ { /* d */ }");
-assert.sameValue(g.toString(), "async /* a */ [ /* b */ \"g\" /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }");
-assert.sameValue(h.toString(), "async /* a */ [ /* b */ x /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }");
+assertToStringOrNativeFunction(f, "async f /* a */ ( /* b */ ) /* c */ { /* d */ }");
+assertToStringOrNativeFunction(g, "async /* a */ [ /* b */ \"g\" /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }");
+assertToStringOrNativeFunction(h, "async /* a */ [ /* b */ x /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }");
diff --git a/test/built-ins/Function/prototype/toString/async-method-class-expression.js b/test/built-ins/Function/prototype/toString/async-method-class-expression.js
index be19ef930f..17511ca845 100644
--- a/test/built-ins/Function/prototype/toString/async-method-class-expression.js
+++ b/test/built-ins/Function/prototype/toString/async-method-class-expression.js
@@ -5,6 +5,7 @@
 esid: sec-function.prototype.tostring
 description: Function.prototype.toString on an async method
 features: [async-functions]
+includes: [nativeFunctionMatcher.js]
 ---*/
 
 let x = "h";
@@ -12,6 +13,6 @@ let f = class { /* before */async f /* a */ ( /* b */ ) /* c */ { /* d */ }/* af
 let g = class { /* before */async /* a */ [ /* b */ "g" /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }/* after */ }.prototype.g;
 let h = class { /* before */async /* a */ [ /* b */ x /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }/* after */ }.prototype.h;
 
-assert.sameValue(f.toString(), "async f /* a */ ( /* b */ ) /* c */ { /* d */ }");
-assert.sameValue(g.toString(), "async /* a */ [ /* b */ \"g\" /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }");
-assert.sameValue(h.toString(), "async /* a */ [ /* b */ x /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }");
+assertToStringOrNativeFunction(f, "async f /* a */ ( /* b */ ) /* c */ { /* d */ }");
+assertToStringOrNativeFunction(g, "async /* a */ [ /* b */ \"g\" /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }");
+assertToStringOrNativeFunction(h, "async /* a */ [ /* b */ x /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }");
diff --git a/test/built-ins/Function/prototype/toString/async-method-class-statement-static.js b/test/built-ins/Function/prototype/toString/async-method-class-statement-static.js
index d20bf935c5..50f4c9ac23 100644
--- a/test/built-ins/Function/prototype/toString/async-method-class-statement-static.js
+++ b/test/built-ins/Function/prototype/toString/async-method-class-statement-static.js
@@ -5,6 +5,7 @@
 esid: sec-function.prototype.tostring
 description: Function.prototype.toString on an async method
 features: [async-functions]
+includes: [nativeFunctionMatcher.js]
 ---*/
 
 let x = "h";
@@ -16,6 +17,6 @@ let f = F.f;
 let g = G.g;
 let h = H.h;
 
-assert.sameValue(f.toString(), "async f /* a */ ( /* b */ ) /* c */ { /* d */ }");
-assert.sameValue(g.toString(), "async /* a */ [ /* b */ \"g\" /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }");
-assert.sameValue(h.toString(), "async /* a */ [ /* b */ x /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }");
+assertToStringOrNativeFunction(f, "async f /* a */ ( /* b */ ) /* c */ { /* d */ }");
+assertToStringOrNativeFunction(g, "async /* a */ [ /* b */ \"g\" /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }");
+assertToStringOrNativeFunction(h, "async /* a */ [ /* b */ x /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }");
diff --git a/test/built-ins/Function/prototype/toString/async-method-class-statement.js b/test/built-ins/Function/prototype/toString/async-method-class-statement.js
index d80ac9e62a..acca014242 100644
--- a/test/built-ins/Function/prototype/toString/async-method-class-statement.js
+++ b/test/built-ins/Function/prototype/toString/async-method-class-statement.js
@@ -5,6 +5,7 @@
 esid: sec-function.prototype.tostring
 description: Function.prototype.toString on an async method
 features: [async-functions]
+includes: [nativeFunctionMatcher.js]
 ---*/
 
 let x = "h";
@@ -16,6 +17,6 @@ let f = F.prototype.f;
 let g = G.prototype.g;
 let h = H.prototype.h;
 
-assert.sameValue(f.toString(), "async f /* a */ ( /* b */ ) /* c */ { /* d */ }");
-assert.sameValue(g.toString(), "async /* a */ [ /* b */ \"g\" /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }");
-assert.sameValue(h.toString(), "async /* a */ [ /* b */ x /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }");
+assertToStringOrNativeFunction(f, "async f /* a */ ( /* b */ ) /* c */ { /* d */ }");
+assertToStringOrNativeFunction(g, "async /* a */ [ /* b */ \"g\" /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }");
+assertToStringOrNativeFunction(h, "async /* a */ [ /* b */ x /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }");
diff --git a/test/built-ins/Function/prototype/toString/async-method-object.js b/test/built-ins/Function/prototype/toString/async-method-object.js
index 9f4c673b47..36f2ab3334 100644
--- a/test/built-ins/Function/prototype/toString/async-method-object.js
+++ b/test/built-ins/Function/prototype/toString/async-method-object.js
@@ -6,6 +6,7 @@ author: Brian Terlson <brian.terlson@microsoft.com>
 esid: sec-function.prototype.tostring
 description: Function.prototype.toString on an async method
 features: [async-functions]
+includes: [nativeFunctionMatcher.js]
 ---*/
 
 let x = "h";
@@ -13,6 +14,6 @@ let f = { /* before */async f /* a */ ( /* b */ ) /* c */ { /* d */ }/* after */
 let g = { /* before */async /* a */ [ /* b */ "g" /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }/* after */ }.g;
 let h = { /* before */async /* a */ [ /* b */ x /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }/* after */ }.h;
 
-assert.sameValue(f.toString(), "async f /* a */ ( /* b */ ) /* c */ { /* d */ }");
-assert.sameValue(g.toString(), "async /* a */ [ /* b */ \"g\" /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }");
-assert.sameValue(h.toString(), "async /* a */ [ /* b */ x /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }");
+assertToStringOrNativeFunction(f, "async f /* a */ ( /* b */ ) /* c */ { /* d */ }");
+assertToStringOrNativeFunction(g, "async /* a */ [ /* b */ \"g\" /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }");
+assertToStringOrNativeFunction(h, "async /* a */ [ /* b */ x /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }");
diff --git a/test/built-ins/Function/prototype/toString/bound-function.js b/test/built-ins/Function/prototype/toString/bound-function.js
index b6ceb116ef..20881fb71e 100644
--- a/test/built-ins/Function/prototype/toString/bound-function.js
+++ b/test/built-ins/Function/prototype/toString/bound-function.js
@@ -9,4 +9,4 @@ includes: [nativeFunctionMatcher.js]
 
 let f = function(){}.bind(null);
 
-assert(NATIVE_FUNCTION_RE.test("" + f), "looks pretty much like a NativeFunction");
+assertNativeFunction(f);
diff --git a/test/built-ins/Function/prototype/toString/class-declaration-complex-heritage.js b/test/built-ins/Function/prototype/toString/class-declaration-complex-heritage.js
index dbf60ee83a..96482e8217 100644
--- a/test/built-ins/Function/prototype/toString/class-declaration-complex-heritage.js
+++ b/test/built-ins/Function/prototype/toString/class-declaration-complex-heritage.js
@@ -4,8 +4,9 @@
 /*---
 esid: sec-runtime-semantics-bindingclassdeclarationevaluation
 description: Function.prototype.toString on a class declaration (with complex heritage)
+includes: [nativeFunctionMatcher.js]
 ---*/
 
 /* before */class /* a */ A /* b */ extends /* c */ class /* d */ B /* e */ { /* f */ } /* g */ { /* h */ }/* after */
 
-assert.sameValue(A.toString(), "class /* a */ A /* b */ extends /* c */ class /* d */ B /* e */ { /* f */ } /* g */ { /* h */ }");
+assertToStringOrNativeFunction(A, "class /* a */ A /* b */ extends /* c */ class /* d */ B /* e */ { /* f */ } /* g */ { /* h */ }");
diff --git a/test/built-ins/Function/prototype/toString/class-declaration-explicit-ctor.js b/test/built-ins/Function/prototype/toString/class-declaration-explicit-ctor.js
index c3b4b264f6..edcc0608f1 100644
--- a/test/built-ins/Function/prototype/toString/class-declaration-explicit-ctor.js
+++ b/test/built-ins/Function/prototype/toString/class-declaration-explicit-ctor.js
@@ -4,10 +4,11 @@
 /*---
 esid: sec-runtime-semantics-bindingclassdeclarationevaluation
 description: Function.prototype.toString on a class declaration (explicit constructor)
+includes: [nativeFunctionMatcher.js]
 ---*/
 
 /* before */class /* a */ A /* b */ extends /* c */ B /* d */ { /* e */ constructor /* f */ ( /* g */ ) /* h */ { /* i */ ; /* j */ } /* k */ m /* l */ ( /* m */ ) /* n */ { /* o */ } /* p */ }/* after */
 
-assert.sameValue(A.toString(), "class /* a */ A /* b */ extends /* c */ B /* d */ { /* e */ constructor /* f */ ( /* g */ ) /* h */ { /* i */ ; /* j */ } /* k */ m /* l */ ( /* m */ ) /* n */ { /* o */ } /* p */ }");
+assertToStringOrNativeFunction(A, "class /* a */ A /* b */ extends /* c */ B /* d */ { /* e */ constructor /* f */ ( /* g */ ) /* h */ { /* i */ ; /* j */ } /* k */ m /* l */ ( /* m */ ) /* n */ { /* o */ } /* p */ }");
 
 function B(){}
diff --git a/test/built-ins/Function/prototype/toString/class-declaration-implicit-ctor.js b/test/built-ins/Function/prototype/toString/class-declaration-implicit-ctor.js
index 9dea84bb61..3f8ab82f7d 100644
--- a/test/built-ins/Function/prototype/toString/class-declaration-implicit-ctor.js
+++ b/test/built-ins/Function/prototype/toString/class-declaration-implicit-ctor.js
@@ -4,12 +4,13 @@
 /*---
 esid: sec-runtime-semantics-bindingclassdeclarationevaluation
 description: Function.prototype.toString on a class declaration (implicit constructor)
+includes: [nativeFunctionMatcher.js]
 ---*/
 
 /* before */class /* a */ A /* b */ { /* c */ }/* after */
 /* before */class /* a */ B /* b */ extends /* c */ A /* d */ { /* e */ }/* after */
 /* before */class /* a */ C /* b */ extends /* c */ B /* d */ { /* e */ m /* f */ ( /* g */ ) /* h */ { /* i */ } /* j */ }/* after */
 
-assert.sameValue(A.toString(), "class /* a */ A /* b */ { /* c */ }");
-assert.sameValue(B.toString(), "class /* a */ B /* b */ extends /* c */ A /* d */ { /* e */ }");
-assert.sameValue(C.toString(), "class /* a */ C /* b */ extends /* c */ B /* d */ { /* e */ m /* f */ ( /* g */ ) /* h */ { /* i */ } /* j */ }");
+assertToStringOrNativeFunction(A, "class /* a */ A /* b */ { /* c */ }");
+assertToStringOrNativeFunction(B, "class /* a */ B /* b */ extends /* c */ A /* d */ { /* e */ }");
+assertToStringOrNativeFunction(C, "class /* a */ C /* b */ extends /* c */ B /* d */ { /* e */ m /* f */ ( /* g */ ) /* h */ { /* i */ } /* j */ }");
diff --git a/test/built-ins/Function/prototype/toString/class-expression-explicit-ctor.js b/test/built-ins/Function/prototype/toString/class-expression-explicit-ctor.js
index 93d7448479..de838da08e 100644
--- a/test/built-ins/Function/prototype/toString/class-expression-explicit-ctor.js
+++ b/test/built-ins/Function/prototype/toString/class-expression-explicit-ctor.js
@@ -4,10 +4,11 @@
 /*---
 esid: sec-class-definitions-runtime-semantics-evaluation
 description: Function.prototype.toString on a class expression (explicit constructor)
+includes: [nativeFunctionMatcher.js]
 ---*/
 
 let A = /* before */class /* a */ A /* b */ extends /* c */ B /* d */ { /* e */ constructor /* f */ ( /* g */ ) /* h */ { /* i */ ; /* j */ } /* k */ m /* l */ ( /* m */ ) /* n */ { /* o */ } /* p */ }/* after */;
 
-assert.sameValue(A.toString(), "class /* a */ A /* b */ extends /* c */ B /* d */ { /* e */ constructor /* f */ ( /* g */ ) /* h */ { /* i */ ; /* j */ } /* k */ m /* l */ ( /* m */ ) /* n */ { /* o */ } /* p */ }");
+assertToStringOrNativeFunction(A, "class /* a */ A /* b */ extends /* c */ B /* d */ { /* e */ constructor /* f */ ( /* g */ ) /* h */ { /* i */ ; /* j */ } /* k */ m /* l */ ( /* m */ ) /* n */ { /* o */ } /* p */ }");
 
 function B(){}
diff --git a/test/built-ins/Function/prototype/toString/class-expression-implicit-ctor.js b/test/built-ins/Function/prototype/toString/class-expression-implicit-ctor.js
index 91ab621341..91ce1b5937 100644
--- a/test/built-ins/Function/prototype/toString/class-expression-implicit-ctor.js
+++ b/test/built-ins/Function/prototype/toString/class-expression-implicit-ctor.js
@@ -4,12 +4,13 @@
 /*---
 esid: sec-class-definitions-runtime-semantics-evaluation
 description: Function.prototype.toString on a class expression (implicit constructor)
+includes: [nativeFunctionMatcher.js]
 ---*/
 
 let A = /* before */class /* a */ A /* b */ { /* c */ }/* after */;
 let B = /* before */class /* a */ B /* b */ extends /* c */ A /* d */ { /* e */ }/* after */;
 let C = /* before */class /* a */ C /* b */ extends /* c */ B /* d */ { /* e */ m /* f */ ( /* g */ ) /* h */ { /* i */ } /* j */ }/* after */;
 
-assert.sameValue(A.toString(), "class /* a */ A /* b */ { /* c */ }");
-assert.sameValue(B.toString(), "class /* a */ B /* b */ extends /* c */ A /* d */ { /* e */ }");
-assert.sameValue(C.toString(), "class /* a */ C /* b */ extends /* c */ B /* d */ { /* e */ m /* f */ ( /* g */ ) /* h */ { /* i */ } /* j */ }");
+assertToStringOrNativeFunction(A, "class /* a */ A /* b */ { /* c */ }");
+assertToStringOrNativeFunction(B, "class /* a */ B /* b */ extends /* c */ A /* d */ { /* e */ }");
+assertToStringOrNativeFunction(C, "class /* a */ C /* b */ extends /* c */ B /* d */ { /* e */ m /* f */ ( /* g */ ) /* h */ { /* i */ } /* j */ }");
diff --git a/test/built-ins/Function/prototype/toString/function-declaration-non-simple-parameter-list.js b/test/built-ins/Function/prototype/toString/function-declaration-non-simple-parameter-list.js
index 7ff7971e01..1b86a9842a 100644
--- a/test/built-ins/Function/prototype/toString/function-declaration-non-simple-parameter-list.js
+++ b/test/built-ins/Function/prototype/toString/function-declaration-non-simple-parameter-list.js
@@ -4,8 +4,9 @@
 /*---
 esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
 description: Function.prototype.toString on a function with a non-simple parameter list
+includes: [nativeFunctionMatcher.js]
 ---*/
 
 /* before */function /* a */ f /* b */ ( /* c */ a /* d */ = /* e */ 0 /* f */ , /* g */ { /* h */ b /* i */ = /* j */ 0 /* k */ } /* l */ ) /* m */ { /* n */ }/* after */
 
-assert.sameValue(f.toString(), "function /* a */ f /* b */ ( /* c */ a /* d */ = /* e */ 0 /* f */ , /* g */ { /* h */ b /* i */ = /* j */ 0 /* k */ } /* l */ ) /* m */ { /* n */ }");
+assertToStringOrNativeFunction(f, "function /* a */ f /* b */ ( /* c */ a /* d */ = /* e */ 0 /* f */ , /* g */ { /* h */ b /* i */ = /* j */ 0 /* k */ } /* l */ ) /* m */ { /* n */ }");
diff --git a/test/built-ins/Function/prototype/toString/function-declaration.js b/test/built-ins/Function/prototype/toString/function-declaration.js
index a0446ba712..c960329107 100644
--- a/test/built-ins/Function/prototype/toString/function-declaration.js
+++ b/test/built-ins/Function/prototype/toString/function-declaration.js
@@ -4,8 +4,9 @@
 /*---
 esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
 description: Function.prototype.toString on a function declaration
+includes: [nativeFunctionMatcher.js]
 ---*/
 
 /* before */function /* a */ f /* b */ ( /* c */ x /* d */ , /* e */ y /* f */ ) /* g */ { /* h */ ; /* i */ ; /* j */ }/* after */
 
-assert.sameValue(f.toString(), "function /* a */ f /* b */ ( /* c */ x /* d */ , /* e */ y /* f */ ) /* g */ { /* h */ ; /* i */ ; /* j */ }");
+assertToStringOrNativeFunction(f, "function /* a */ f /* b */ ( /* c */ x /* d */ , /* e */ y /* f */ ) /* g */ { /* h */ ; /* i */ ; /* j */ }");
diff --git a/test/built-ins/Function/prototype/toString/function-expression.js b/test/built-ins/Function/prototype/toString/function-expression.js
index b1bcedaf49..251d06c7ff 100644
--- a/test/built-ins/Function/prototype/toString/function-expression.js
+++ b/test/built-ins/Function/prototype/toString/function-expression.js
@@ -4,10 +4,11 @@
 /*---
 esid: sec-function-definitions-runtime-semantics-evaluation
 description: Function.prototype.toString on a function expression
+includes: [nativeFunctionMatcher.js]
 ---*/
 
 let f = /* before */function /* a */ F /* b */ ( /* c */ x /* d */ , /* e */ y /* f */ ) /* g */ { /* h */ ; /* i */ ; /* j */ }/* after */;
 let g = /* before */function /* a */ ( /* b */ x /* c */ , /* d */ y /* e */ ) /* f */ { /* g */ ; /* h */ ; /* i */ }/* after */;
 
-assert.sameValue(f.toString(), "function /* a */ F /* b */ ( /* c */ x /* d */ , /* e */ y /* f */ ) /* g */ { /* h */ ; /* i */ ; /* j */ }");
-assert.sameValue(g.toString(), "function /* a */ ( /* b */ x /* c */ , /* d */ y /* e */ ) /* f */ { /* g */ ; /* h */ ; /* i */ }");
+assertToStringOrNativeFunction(f, "function /* a */ F /* b */ ( /* c */ x /* d */ , /* e */ y /* f */ ) /* g */ { /* h */ ; /* i */ ; /* j */ }");
+assertToStringOrNativeFunction(g, "function /* a */ ( /* b */ x /* c */ , /* d */ y /* e */ ) /* f */ { /* g */ ; /* h */ ; /* i */ }");
diff --git a/test/built-ins/Function/prototype/toString/generator-function-declaration.js b/test/built-ins/Function/prototype/toString/generator-function-declaration.js
index 133f9af8cb..5ba2dd25b7 100644
--- a/test/built-ins/Function/prototype/toString/generator-function-declaration.js
+++ b/test/built-ins/Function/prototype/toString/generator-function-declaration.js
@@ -4,8 +4,9 @@
 /*---
 esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
 description: Function.prototype.toString on a generator function declaration
+includes: [nativeFunctionMatcher.js]
 ---*/
 
 /* before */function /* a */ * /* b */ g /* c */ ( /* d */ x /* e */ , /* f */ y /* g */ ) /* h */ { /* i */ ; /* j */ ; /* k */ }/* after */
 
-assert.sameValue(g.toString(), "function /* a */ * /* b */ g /* c */ ( /* d */ x /* e */ , /* f */ y /* g */ ) /* h */ { /* i */ ; /* j */ ; /* k */ }");
+assertToStringOrNativeFunction(g, "function /* a */ * /* b */ g /* c */ ( /* d */ x /* e */ , /* f */ y /* g */ ) /* h */ { /* i */ ; /* j */ ; /* k */ }");
diff --git a/test/built-ins/Function/prototype/toString/generator-function-expression.js b/test/built-ins/Function/prototype/toString/generator-function-expression.js
index d175055ec1..054562e001 100644
--- a/test/built-ins/Function/prototype/toString/generator-function-expression.js
+++ b/test/built-ins/Function/prototype/toString/generator-function-expression.js
@@ -4,10 +4,11 @@
 /*---
 esid: sec-generator-function-definitions-runtime-semantics-evaluation
 description: Function.prototype.toString on a generator function expression
+includes: [nativeFunctionMatcher.js]
 ---*/
 
 let f = /* before */function /* a */ * /* b */ F /* c */ ( /* d */ x /* e */ , /* f */ y /* g */ ) /* h */ { /* i */ ; /* j */ ; /* k */ }/* after */
 let g = /* before */function /* a */ * /* b */ ( /* c */ x /* d */ , /* e */ y /* f */ ) /* g */ { /* h */ ; /* i */ ; /* j */ }/* after */
 
-assert.sameValue(f.toString(), "function /* a */ * /* b */ F /* c */ ( /* d */ x /* e */ , /* f */ y /* g */ ) /* h */ { /* i */ ; /* j */ ; /* k */ }");
-assert.sameValue(g.toString(), "function /* a */ * /* b */ ( /* c */ x /* d */ , /* e */ y /* f */ ) /* g */ { /* h */ ; /* i */ ; /* j */ }");
+assertToStringOrNativeFunction(f, "function /* a */ * /* b */ F /* c */ ( /* d */ x /* e */ , /* f */ y /* g */ ) /* h */ { /* i */ ; /* j */ ; /* k */ }");
+assertToStringOrNativeFunction(g, "function /* a */ * /* b */ ( /* c */ x /* d */ , /* e */ y /* f */ ) /* g */ { /* h */ ; /* i */ ; /* j */ }");
diff --git a/test/built-ins/Function/prototype/toString/generator-method.js b/test/built-ins/Function/prototype/toString/generator-method.js
index f5cb5d2187..a4cf16ef65 100644
--- a/test/built-ins/Function/prototype/toString/generator-method.js
+++ b/test/built-ins/Function/prototype/toString/generator-method.js
@@ -4,6 +4,7 @@
 /*---
 esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation
 description: Function.prototype.toString on a generator method
+includes: [nativeFunctionMatcher.js]
 ---*/
 
 let x = "h";
@@ -11,6 +12,6 @@ let f = { /* before */* /* a */ f /* b */ ( /* c */ ) /* d */ { /* e */ }/* afte
 let g = { /* before */* /* a */ [ /* b */ "g" /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }/* after */ }.g;
 let h = { /* before */* /* a */ [ /* b */ x /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }/* after */ }.h;
 
-assert.sameValue(f.toString(), "* /* a */ f /* b */ ( /* c */ ) /* d */ { /* e */ }");
-assert.sameValue(g.toString(), "* /* a */ [ /* b */ \"g\" /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }");
-assert.sameValue(h.toString(), "* /* a */ [ /* b */ x /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }");
+assertToStringOrNativeFunction(f, "* /* a */ f /* b */ ( /* c */ ) /* d */ { /* e */ }");
+assertToStringOrNativeFunction(g, "* /* a */ [ /* b */ \"g\" /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }");
+assertToStringOrNativeFunction(h, "* /* a */ [ /* b */ x /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }");
diff --git a/test/built-ins/Function/prototype/toString/getter-class-expression-static.js b/test/built-ins/Function/prototype/toString/getter-class-expression-static.js
index 009d92127b..d646abae3f 100644
--- a/test/built-ins/Function/prototype/toString/getter-class-expression-static.js
+++ b/test/built-ins/Function/prototype/toString/getter-class-expression-static.js
@@ -4,6 +4,7 @@
 /*---
 esid: sec-method-definitions-runtime-semantics-propertydefinitionevaluation
 description: Function.prototype.toString on a getter (class; static)
+includes: [nativeFunctionMatcher.js]
 ---*/
 
 let x = "h";
@@ -11,6 +12,6 @@ let f = Object.getOwnPropertyDescriptor(class { static /* before */get /* a */ f
 let g = Object.getOwnPropertyDescriptor(class { static /* before */get /* a */ [ /* b */ "g" /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }/* after */ }, "g").get;
 let h = Object.getOwnPropertyDescriptor(class { static /* before */get /* a */ [ /* b */ x /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }/* after */ }, "h").get;
 
-assert.sameValue(f.toString(), "get /* a */ f /* b */ ( /* c */ ) /* d */ { /* e */ }");
-assert.sameValue(g.toString(), "get /* a */ [ /* b */ \"g\" /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }");
-assert.sameValue(h.toString(), "get /* a */ [ /* b */ x /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }");
+assertToStringOrNativeFunction(f, "get /* a */ f /* b */ ( /* c */ ) /* d */ { /* e */ }");
+assertToStringOrNativeFunction(g, "get /* a */ [ /* b */ \"g\" /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }");
+assertToStringOrNativeFunction(h, "get /* a */ [ /* b */ x /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }");
diff --git a/test/built-ins/Function/prototype/toString/getter-class-expression.js b/test/built-ins/Function/prototype/toString/getter-class-expression.js
index 7b3eef410a..923a257e9b 100644
--- a/test/built-ins/Function/prototype/toString/getter-class-expression.js
+++ b/test/built-ins/Function/prototype/toString/getter-class-expression.js
@@ -4,6 +4,7 @@
 /*---
 esid: sec-method-definitions-runtime-semantics-propertydefinitionevaluation
 description: Function.prototype.toString on a getter (class)
+includes: [nativeFunctionMatcher.js]
 ---*/
 
 let x = "h";
@@ -11,6 +12,6 @@ let f = Object.getOwnPropertyDescriptor(class { /* before */get /* a */ f /* b *
 let g = Object.getOwnPropertyDescriptor(class { /* before */get /* a */ [ /* b */ "g" /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }/* after */ }.prototype, "g").get;
 let h = Object.getOwnPropertyDescriptor(class { /* before */get /* a */ [ /* b */ x /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }/* after */ }.prototype, "h").get;
 
-assert.sameValue(f.toString(), "get /* a */ f /* b */ ( /* c */ ) /* d */ { /* e */ }");
-assert.sameValue(g.toString(), "get /* a */ [ /* b */ \"g\" /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }");
-assert.sameValue(h.toString(), "get /* a */ [ /* b */ x /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }");
+assertToStringOrNativeFunction(f, "get /* a */ f /* b */ ( /* c */ ) /* d */ { /* e */ }");
+assertToStringOrNativeFunction(g, "get /* a */ [ /* b */ \"g\" /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }");
+assertToStringOrNativeFunction(h, "get /* a */ [ /* b */ x /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }");
diff --git a/test/built-ins/Function/prototype/toString/getter-class-statement-static.js b/test/built-ins/Function/prototype/toString/getter-class-statement-static.js
index 4ac72bccdd..350634b103 100644
--- a/test/built-ins/Function/prototype/toString/getter-class-statement-static.js
+++ b/test/built-ins/Function/prototype/toString/getter-class-statement-static.js
@@ -4,6 +4,7 @@
 /*---
 esid: sec-method-definitions-runtime-semantics-propertydefinitionevaluation
 description: Function.prototype.toString on a getter (class; static)
+includes: [nativeFunctionMatcher.js]
 ---*/
 
 let x = "h";
@@ -15,6 +16,6 @@ let f = Object.getOwnPropertyDescriptor(F, "f").get;
 let g = Object.getOwnPropertyDescriptor(G, "g").get;
 let h = Object.getOwnPropertyDescriptor(H, "h").get;
 
-assert.sameValue(f.toString(), "get /* a */ f /* b */ ( /* c */ ) /* d */ { /* e */ }");
-assert.sameValue(g.toString(), "get /* a */ [ /* b */ \"g\" /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }");
-assert.sameValue(h.toString(), "get /* a */ [ /* b */ x /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }");
+assertToStringOrNativeFunction(f, "get /* a */ f /* b */ ( /* c */ ) /* d */ { /* e */ }");
+assertToStringOrNativeFunction(g, "get /* a */ [ /* b */ \"g\" /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }");
+assertToStringOrNativeFunction(h, "get /* a */ [ /* b */ x /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }");
diff --git a/test/built-ins/Function/prototype/toString/getter-class-statement.js b/test/built-ins/Function/prototype/toString/getter-class-statement.js
index 83139c33c4..4da490a255 100644
--- a/test/built-ins/Function/prototype/toString/getter-class-statement.js
+++ b/test/built-ins/Function/prototype/toString/getter-class-statement.js
@@ -4,6 +4,7 @@
 /*---
 esid: sec-method-definitions-runtime-semantics-propertydefinitionevaluation
 description: Function.prototype.toString on a getter (class)
+includes: [nativeFunctionMatcher.js]
 ---*/
 
 let x = "h";
@@ -15,6 +16,6 @@ let f = Object.getOwnPropertyDescriptor(F.prototype, "f").get;
 let g = Object.getOwnPropertyDescriptor(G.prototype, "g").get;
 let h = Object.getOwnPropertyDescriptor(H.prototype, "h").get;
 
-assert.sameValue(f.toString(), "get /* a */ f /* b */ ( /* c */ ) /* d */ { /* e */ }");
-assert.sameValue(g.toString(), "get /* a */ [ /* b */ \"g\" /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }");
-assert.sameValue(h.toString(), "get /* a */ [ /* b */ x /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }");
+assertToStringOrNativeFunction(f, "get /* a */ f /* b */ ( /* c */ ) /* d */ { /* e */ }");
+assertToStringOrNativeFunction(g, "get /* a */ [ /* b */ \"g\" /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }");
+assertToStringOrNativeFunction(h, "get /* a */ [ /* b */ x /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }");
diff --git a/test/built-ins/Function/prototype/toString/getter-object.js b/test/built-ins/Function/prototype/toString/getter-object.js
index 3e794d04bd..801da03a9b 100644
--- a/test/built-ins/Function/prototype/toString/getter-object.js
+++ b/test/built-ins/Function/prototype/toString/getter-object.js
@@ -4,6 +4,7 @@
 /*---
 esid: sec-method-definitions-runtime-semantics-propertydefinitionevaluation
 description: Function.prototype.toString on a getter (object)
+includes: [nativeFunctionMatcher.js]
 ---*/
 
 let x = "h";
@@ -11,6 +12,6 @@ let f = Object.getOwnPropertyDescriptor({ /* before */get /* a */ f /* b */ ( /*
 let g = Object.getOwnPropertyDescriptor({ /* before */get /* a */ [ /* b */ "g" /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }/* after */ }, "g").get;
 let h = Object.getOwnPropertyDescriptor({ /* before */get /* a */ [ /* b */ x /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }/* after */ }, "h").get;
 
-assert.sameValue(f.toString(), "get /* a */ f /* b */ ( /* c */ ) /* d */ { /* e */ }");
-assert.sameValue(g.toString(), "get /* a */ [ /* b */ \"g\" /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }");
-assert.sameValue(h.toString(), "get /* a */ [ /* b */ x /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }");
+assertToStringOrNativeFunction(f, "get /* a */ f /* b */ ( /* c */ ) /* d */ { /* e */ }");
+assertToStringOrNativeFunction(g, "get /* a */ [ /* b */ \"g\" /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }");
+assertToStringOrNativeFunction(h, "get /* a */ [ /* b */ x /* c */ ] /* d */ ( /* e */ ) /* f */ { /* g */ }");
diff --git a/test/built-ins/Function/prototype/toString/intrinsics.js b/test/built-ins/Function/prototype/toString/intrinsics.js
index dc13195961..7cb08d4ba8 100644
--- a/test/built-ins/Function/prototype/toString/intrinsics.js
+++ b/test/built-ins/Function/prototype/toString/intrinsics.js
@@ -20,5 +20,5 @@ for (let intrinsicName in intrinsics) {
   let str = Function.prototype.toString.call(intrinsic);
   assert.sameValue(typeof str, "string");
   assert(RegExp('\\b' + intrinsicName + '\\b').test(str), "contains its name");
-  assert(NATIVE_FUNCTION_RE.test(str), "looks pretty much like a NativeFunction");
+  assertNativeFunction(intrinsic);
 }
diff --git a/test/built-ins/Function/prototype/toString/line-terminator-normalisation-CR-LF.js b/test/built-ins/Function/prototype/toString/line-terminator-normalisation-CR-LF.js
index 93f653936a..a7b438e2e4 100644
--- a/test/built-ins/Function/prototype/toString/line-terminator-normalisation-CR-LF.js
+++ b/test/built-ins/Function/prototype/toString/line-terminator-normalisation-CR-LF.js
@@ -7,6 +7,7 @@ description: Function.prototype.toString line terminator normalisation (CR-LF)
 info: |
   Function.prototype.toString should not normalise line terminator sequences to Line Feed characters.
   This file uses (Carriage Return, Line Feed) sequences as line terminators.
+includes: [nativeFunctionMatcher.js]
 ---*/
 
 // before
@@ -33,4 +34,4 @@ y
 }
 // after
 
-assert.sameValue(f.toString(), "function\r\n// a\r\nf\r\n// b\r\n(\r\n// c\r\nx\r\n// d\r\n,\r\n// e\r\ny\r\n// f\r\n)\r\n// g\r\n{\r\n// h\r\n;\r\n// i\r\n;\r\n// j\r\n}");
+assertToStringOrNativeFunction(f, "function\r\n// a\r\nf\r\n// b\r\n(\r\n// c\r\nx\r\n// d\r\n,\r\n// e\r\ny\r\n// f\r\n)\r\n// g\r\n{\r\n// h\r\n;\r\n// i\r\n;\r\n// j\r\n}");
diff --git a/test/built-ins/Function/prototype/toString/line-terminator-normalisation-CR.js b/test/built-ins/Function/prototype/toString/line-terminator-normalisation-CR.js
index 4e55706f64..402c0b80fe 100644
--- a/test/built-ins/Function/prototype/toString/line-terminator-normalisation-CR.js
+++ b/test/built-ins/Function/prototype/toString/line-terminator-normalisation-CR.js
@@ -1 +1 @@
-// Copyright (C) 2016 Michael Ficarra. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
description: Function.prototype.toString line terminator normalisation (CR)
info: |
  Function.prototype.toString should not normalise line terminator sequences to Line Feed characters.
  This file uses Carriage Return characters as line terminators.
---*/

// before
function
// a
f
// b
(
// c
x
// d
,
// e
y
// f
)
// g
{
// h
;
// i
;
// j
}
// after

assert.sameValue(f.toString(), "function\r// a\rf\r// b\r(\r// c\rx\r// d\r,\r// e\ry\r// f\r)\r// g\r{\r// h\r;\r// i\r;\r// j\r}");
+// Copyright (C) 2016 Michael Ficarra. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
description: Function.prototype.toString line terminator normalisation (CR)
info: |
  Function.prototype.toString should not normalise line terminator sequences to Line Feed characters.
  This file uses Carriage Return characters as line terminators.
includes: [nativeFunctionMatcher.js]
---*/

// before
function
// a
f
// b
(
// c
x
// d
,
// e
y
// f
)
// g
{
// h
;
// i
;
// j
}
// after

assertToStringOrNativeFunction(f, "function\r// a\rf\r// b\r(\r// c\rx\r// d\r,\r// e\ry\r// f\r)\r// g\r{\r// h\r;\r// i\r;\r// j\r}");
diff --git a/test/built-ins/Function/prototype/toString/line-terminator-normalisation-LF.js b/test/built-ins/Function/prototype/toString/line-terminator-normalisation-LF.js
index 69b7855430..ec629a60b7 100644
--- a/test/built-ins/Function/prototype/toString/line-terminator-normalisation-LF.js
+++ b/test/built-ins/Function/prototype/toString/line-terminator-normalisation-LF.js
@@ -7,6 +7,7 @@ description: Function.prototype.toString line terminator normalisation (LF)
 info: |
   Function.prototype.toString should not normalise line terminator sequences to Line Feed characters.
   This file uses Line Feed characters as line terminators.
+includes: [nativeFunctionMatcher.js]
 ---*/
 
 // before
@@ -33,4 +34,4 @@ y
 }
 // after
 
-assert.sameValue(f.toString(), "function\n// a\nf\n// b\n(\n// c\nx\n// d\n,\n// e\ny\n// f\n)\n// g\n{\n// h\n;\n// i\n;\n// j\n}");
+assertToStringOrNativeFunction(f, "function\n// a\nf\n// b\n(\n// c\nx\n// d\n,\n// e\ny\n// f\n)\n// g\n{\n// h\n;\n// i\n;\n// j\n}");
diff --git a/test/built-ins/Function/prototype/toString/method-class-expression-static.js b/test/built-ins/Function/prototype/toString/method-class-expression-static.js
index 9a81f8f10f..5abb0862bd 100644
--- a/test/built-ins/Function/prototype/toString/method-class-expression-static.js
+++ b/test/built-ins/Function/prototype/toString/method-class-expression-static.js
@@ -4,6 +4,7 @@
 /*---
 esid: sec-runtime-semantics-definemethod
 description: Function.prototype.toString on a method (class; static)
+includes: [nativeFunctionMatcher.js]
 ---*/
 
 let x = "h";
@@ -11,6 +12,6 @@ let f = class { static /* before */f /* a */ ( /* b */ ) /* c */ { /* d */ }/* a
 let g = class { static /* before */[ /* a */ "g" /* b */ ] /* c */ ( /* d */ ) /* e */ { /* f */ }/* after */ }.g;
 let h = class { static /* before */[ /* a */ x /* b */ ] /* c */ ( /* d */ ) /* e */ { /* f */ }/* after */ }.h;
 
-assert.sameValue(f.toString(), "f /* a */ ( /* b */ ) /* c */ { /* d */ }");
-assert.sameValue(g.toString(), "[ /* a */ \"g\" /* b */ ] /* c */ ( /* d */ ) /* e */ { /* f */ }");
-assert.sameValue(h.toString(), "[ /* a */ x /* b */ ] /* c */ ( /* d */ ) /* e */ { /* f */ }");
+assertToStringOrNativeFunction(f, "f /* a */ ( /* b */ ) /* c */ { /* d */ }");
+assertToStringOrNativeFunction(g, "[ /* a */ \"g\" /* b */ ] /* c */ ( /* d */ ) /* e */ { /* f */ }");
+assertToStringOrNativeFunction(h, "[ /* a */ x /* b */ ] /* c */ ( /* d */ ) /* e */ { /* f */ }");
diff --git a/test/built-ins/Function/prototype/toString/method-class-expression.js b/test/built-ins/Function/prototype/toString/method-class-expression.js
index cdfe9643ed..5089dafb66 100644
--- a/test/built-ins/Function/prototype/toString/method-class-expression.js
+++ b/test/built-ins/Function/prototype/toString/method-class-expression.js
@@ -4,6 +4,7 @@
 /*---
 esid: sec-runtime-semantics-definemethod
 description: Function.prototype.toString on a method (class)
+includes: [nativeFunctionMatcher.js]
 ---*/
 
 let x = "h";
@@ -11,6 +12,6 @@ let f = class { /* before */f /* a */ ( /* b */ ) /* c */ { /* d */ }/* after */
 let g = class { /* before */[ /* a */ "g" /* b */ ] /* c */ ( /* d */ ) /* e */ { /* f */ }/* after */ }.prototype.g;
 let h = class { /* before */[ /* a */ x /* b */ ] /* c */ ( /* d */ ) /* e */ { /* f */ }/* after */ }.prototype.h;
 
-assert.sameValue(f.toString(), "f /* a */ ( /* b */ ) /* c */ { /* d */ }");
-assert.sameValue(g.toString(), "[ /* a */ \"g\" /* b */ ] /* c */ ( /* d */ ) /* e */ { /* f */ }");
-assert.sameValue(h.toString(), "[ /* a */ x /* b */ ] /* c */ ( /* d */ ) /* e */ { /* f */ }");
+assertToStringOrNativeFunction(f, "f /* a */ ( /* b */ ) /* c */ { /* d */ }");
+assertToStringOrNativeFunction(g, "[ /* a */ \"g\" /* b */ ] /* c */ ( /* d */ ) /* e */ { /* f */ }");
+assertToStringOrNativeFunction(h, "[ /* a */ x /* b */ ] /* c */ ( /* d */ ) /* e */ { /* f */ }");
diff --git a/test/built-ins/Function/prototype/toString/method-class-statement-static.js b/test/built-ins/Function/prototype/toString/method-class-statement-static.js
index f8e9817a8f..67d50f1183 100644
--- a/test/built-ins/Function/prototype/toString/method-class-statement-static.js
+++ b/test/built-ins/Function/prototype/toString/method-class-statement-static.js
@@ -4,6 +4,7 @@
 /*---
 esid: sec-runtime-semantics-definemethod
 description: Function.prototype.toString on a method (class; static)
+includes: [nativeFunctionMatcher.js]
 ---*/
 
 let x = "h";
@@ -15,6 +16,6 @@ let f = F.f;
 let g = G.g;
 let h = H.h;
 
-assert.sameValue(f.toString(), "f /* a */ ( /* b */ ) /* c */ { /* d */ }");
-assert.sameValue(g.toString(), "[ /* a */ \"g\" /* b */ ] /* c */ ( /* d */ ) /* e */ { /* f */ }");
-assert.sameValue(h.toString(), "[ /* a */ x /* b */ ] /* c */ ( /* d */ ) /* e */ { /* f */ }");
+assertToStringOrNativeFunction(f, "f /* a */ ( /* b */ ) /* c */ { /* d */ }");
+assertToStringOrNativeFunction(g, "[ /* a */ \"g\" /* b */ ] /* c */ ( /* d */ ) /* e */ { /* f */ }");
+assertToStringOrNativeFunction(h, "[ /* a */ x /* b */ ] /* c */ ( /* d */ ) /* e */ { /* f */ }");
diff --git a/test/built-ins/Function/prototype/toString/method-class-statement.js b/test/built-ins/Function/prototype/toString/method-class-statement.js
index 3ee83d514c..f45aa2d0ac 100644
--- a/test/built-ins/Function/prototype/toString/method-class-statement.js
+++ b/test/built-ins/Function/prototype/toString/method-class-statement.js
@@ -4,6 +4,7 @@
 /*---
 esid: sec-runtime-semantics-definemethod
 description: Function.prototype.toString on a method (class)
+includes: [nativeFunctionMatcher.js]
 ---*/
 
 let x = "h";
@@ -15,6 +16,6 @@ let f = F.prototype.f;
 let g = G.prototype.g;
 let h = H.prototype.h;
 
-assert.sameValue(f.toString(), "f /* a */ ( /* b */ ) /* c */ { /* d */ }");
-assert.sameValue(g.toString(), "[ /* a */ \"g\" /* b */ ] /* c */ ( /* d */ ) /* e */ { /* f */ }");
-assert.sameValue(h.toString(), "[ /* a */ x /* b */ ] /* c */ ( /* d */ ) /* e */ { /* f */ }");
+assertToStringOrNativeFunction(f, "f /* a */ ( /* b */ ) /* c */ { /* d */ }");
+assertToStringOrNativeFunction(g, "[ /* a */ \"g\" /* b */ ] /* c */ ( /* d */ ) /* e */ { /* f */ }");
+assertToStringOrNativeFunction(h, "[ /* a */ x /* b */ ] /* c */ ( /* d */ ) /* e */ { /* f */ }");
diff --git a/test/built-ins/Function/prototype/toString/method-computed-property-name.js b/test/built-ins/Function/prototype/toString/method-computed-property-name.js
index dcf692d23d..8b8270909f 100644
--- a/test/built-ins/Function/prototype/toString/method-computed-property-name.js
+++ b/test/built-ins/Function/prototype/toString/method-computed-property-name.js
@@ -4,10 +4,11 @@
 /*---
 esid: sec-runtime-semantics-definemethod
 description: Function.prototype.toString on a method (object)
+includes: [nativeFunctionMatcher.js]
 ---*/
 
 let f = { /* before */[ /* a */ "f" /* b */ ] /* c */ ( /* d */ ) /* e */ { /* f */ }/* after */ }.f;
 let g = { [ { a(){} }.a ](){ } }["a(){}"];
 
-assert.sameValue(f.toString(), "[ /* a */ \"f\" /* b */ ] /* c */ ( /* d */ ) /* e */ { /* f */ }");
-assert.sameValue("" + g, "[ { a(){} }.a ](){ }");
+assertToStringOrNativeFunction(f, "[ /* a */ \"f\" /* b */ ] /* c */ ( /* d */ ) /* e */ { /* f */ }");
+assertToStringOrNativeFunction(g, "[ { a(){} }.a ](){ }");
diff --git a/test/built-ins/Function/prototype/toString/method-object.js b/test/built-ins/Function/prototype/toString/method-object.js
index 6930964ed1..088eb3ade8 100644
--- a/test/built-ins/Function/prototype/toString/method-object.js
+++ b/test/built-ins/Function/prototype/toString/method-object.js
@@ -4,8 +4,9 @@
 /*---
 esid: sec-runtime-semantics-definemethod
 description: Function.prototype.toString on a method (object)
+includes: [nativeFunctionMatcher.js]
 ---*/
 
 let f = { /* before */f /* a */ ( /* b */ ) /* c */ { /* d */ }/* after */ }.f;
 
-assert.sameValue(f.toString(), "f /* a */ ( /* b */ ) /* c */ { /* d */ }");
+assertToStringOrNativeFunction(f, "f /* a */ ( /* b */ ) /* c */ { /* d */ }");
diff --git a/test/built-ins/Function/prototype/toString/setter-class-expression-static.js b/test/built-ins/Function/prototype/toString/setter-class-expression-static.js
index ab0b1ede43..51719e589b 100644
--- a/test/built-ins/Function/prototype/toString/setter-class-expression-static.js
+++ b/test/built-ins/Function/prototype/toString/setter-class-expression-static.js
@@ -4,6 +4,7 @@
 /*---
 esid: sec-method-definitions-runtime-semantics-propertydefinitionevaluation
 description: Function.prototype.toString on a setter (class; static)
+includes: [nativeFunctionMatcher.js]
 ---*/
 
 let x = "h";
@@ -11,6 +12,6 @@ let f = Object.getOwnPropertyDescriptor(class { static /* before */set /* a */ f
 let g = Object.getOwnPropertyDescriptor(class { static /* before */set /* a */ [ /* b */ "g" /* c */ ] /* d */ ( /* e */ a /* f */ ) /* g */ { /* h */ }/* after */ }, "g").set;
 let h = Object.getOwnPropertyDescriptor(class { static /* before */set /* a */ [ /* b */ x /* c */ ] /* d */ ( /* e */ a /* f */ ) /* g */ { /* h */ }/* after */ }, "h").set;
 
-assert.sameValue(f.toString(), "set /* a */ f /* b */ ( /* c */ a /* d */ ) /* e */ { /* f */ }");
-assert.sameValue(g.toString(), "set /* a */ [ /* b */ \"g\" /* c */ ] /* d */ ( /* e */ a /* f */ ) /* g */ { /* h */ }");
-assert.sameValue(h.toString(), "set /* a */ [ /* b */ x /* c */ ] /* d */ ( /* e */ a /* f */ ) /* g */ { /* h */ }");
+assertToStringOrNativeFunction(f, "set /* a */ f /* b */ ( /* c */ a /* d */ ) /* e */ { /* f */ }");
+assertToStringOrNativeFunction(g, "set /* a */ [ /* b */ \"g\" /* c */ ] /* d */ ( /* e */ a /* f */ ) /* g */ { /* h */ }");
+assertToStringOrNativeFunction(h, "set /* a */ [ /* b */ x /* c */ ] /* d */ ( /* e */ a /* f */ ) /* g */ { /* h */ }");
diff --git a/test/built-ins/Function/prototype/toString/setter-class-expression.js b/test/built-ins/Function/prototype/toString/setter-class-expression.js
index b34b4128e5..10842e10bc 100644
--- a/test/built-ins/Function/prototype/toString/setter-class-expression.js
+++ b/test/built-ins/Function/prototype/toString/setter-class-expression.js
@@ -4,6 +4,7 @@
 /*---
 esid: sec-method-definitions-runtime-semantics-propertydefinitionevaluation
 description: Function.prototype.toString on a setter (class)
+includes: [nativeFunctionMatcher.js]
 ---*/
 
 let x = "h";
@@ -11,6 +12,6 @@ let f = Object.getOwnPropertyDescriptor(class { /* before */set /* a */ f /* b *
 let g = Object.getOwnPropertyDescriptor(class { /* before */set /* a */ [ /* b */ "g" /* c */ ] /* d */ ( /* e */ a /* f */ ) /* g */ { /* h */ }/* after */ }.prototype, "g").set;
 let h = Object.getOwnPropertyDescriptor(class { /* before */set /* a */ [ /* b */ x /* c */ ] /* d */ ( /* e */ a /* f */ ) /* g */ { /* h */ }/* after */ }.prototype, "h").set;
 
-assert.sameValue(f.toString(), "set /* a */ f /* b */ ( /* c */ a /* d */ ) /* e */ { /* f */ }");
-assert.sameValue(g.toString(), "set /* a */ [ /* b */ \"g\" /* c */ ] /* d */ ( /* e */ a /* f */ ) /* g */ { /* h */ }");
-assert.sameValue(h.toString(), "set /* a */ [ /* b */ x /* c */ ] /* d */ ( /* e */ a /* f */ ) /* g */ { /* h */ }");
+assertToStringOrNativeFunction(f, "set /* a */ f /* b */ ( /* c */ a /* d */ ) /* e */ { /* f */ }");
+assertToStringOrNativeFunction(g, "set /* a */ [ /* b */ \"g\" /* c */ ] /* d */ ( /* e */ a /* f */ ) /* g */ { /* h */ }");
+assertToStringOrNativeFunction(h, "set /* a */ [ /* b */ x /* c */ ] /* d */ ( /* e */ a /* f */ ) /* g */ { /* h */ }");
diff --git a/test/built-ins/Function/prototype/toString/setter-class-statement-static.js b/test/built-ins/Function/prototype/toString/setter-class-statement-static.js
index 7a5a37de0a..16bbf4c562 100644
--- a/test/built-ins/Function/prototype/toString/setter-class-statement-static.js
+++ b/test/built-ins/Function/prototype/toString/setter-class-statement-static.js
@@ -4,6 +4,7 @@
 /*---
 esid: sec-method-definitions-runtime-semantics-propertydefinitionevaluation
 description: Function.prototype.toString on a setter (class; static)
+includes: [nativeFunctionMatcher.js]
 ---*/
 
 let x = "h";
@@ -15,6 +16,6 @@ let f = Object.getOwnPropertyDescriptor(F, "f").set;
 let g = Object.getOwnPropertyDescriptor(G, "g").set;
 let h = Object.getOwnPropertyDescriptor(H, "h").set;
 
-assert.sameValue(f.toString(), "set /* a */ f /* b */ ( /* c */ a /* d */ ) /* e */ { /* f */ }");
-assert.sameValue(g.toString(), "set /* a */ [ /* b */ \"g\" /* c */ ] /* d */ ( /* e */ a /* f */ ) /* g */ { /* h */ }");
-assert.sameValue(h.toString(), "set /* a */ [ /* b */ x /* c */ ] /* d */ ( /* e */ a /* f */ ) /* g */ { /* h */ }");
+assertToStringOrNativeFunction(f, "set /* a */ f /* b */ ( /* c */ a /* d */ ) /* e */ { /* f */ }");
+assertToStringOrNativeFunction(g, "set /* a */ [ /* b */ \"g\" /* c */ ] /* d */ ( /* e */ a /* f */ ) /* g */ { /* h */ }");
+assertToStringOrNativeFunction(h, "set /* a */ [ /* b */ x /* c */ ] /* d */ ( /* e */ a /* f */ ) /* g */ { /* h */ }");
diff --git a/test/built-ins/Function/prototype/toString/setter-class-statement.js b/test/built-ins/Function/prototype/toString/setter-class-statement.js
index 7c0c2b3e0c..366e4b54bf 100644
--- a/test/built-ins/Function/prototype/toString/setter-class-statement.js
+++ b/test/built-ins/Function/prototype/toString/setter-class-statement.js
@@ -4,6 +4,7 @@
 /*---
 esid: sec-method-definitions-runtime-semantics-propertydefinitionevaluation
 description: Function.prototype.toString on a setter (class)
+includes: [nativeFunctionMatcher.js]
 ---*/
 
 let x = "h";
@@ -15,6 +16,6 @@ let f = Object.getOwnPropertyDescriptor(F.prototype, "f").set;
 let g = Object.getOwnPropertyDescriptor(G.prototype, "g").set;
 let h = Object.getOwnPropertyDescriptor(H.prototype, "h").set;
 
-assert.sameValue(f.toString(), "set /* a */ f /* b */ ( /* c */ a /* d */ ) /* e */ { /* f */ }");
-assert.sameValue(g.toString(), "set /* a */ [ /* b */ \"g\" /* c */ ] /* d */ ( /* e */ a /* f */ ) /* g */ { /* h */ }");
-assert.sameValue(h.toString(), "set /* a */ [ /* b */ x /* c */ ] /* d */ ( /* e */ a /* f */ ) /* g */ { /* h */ }");
+assertToStringOrNativeFunction(f, "set /* a */ f /* b */ ( /* c */ a /* d */ ) /* e */ { /* f */ }");
+assertToStringOrNativeFunction(g, "set /* a */ [ /* b */ \"g\" /* c */ ] /* d */ ( /* e */ a /* f */ ) /* g */ { /* h */ }");
+assertToStringOrNativeFunction(h, "set /* a */ [ /* b */ x /* c */ ] /* d */ ( /* e */ a /* f */ ) /* g */ { /* h */ }");
diff --git a/test/built-ins/Function/prototype/toString/setter-object.js b/test/built-ins/Function/prototype/toString/setter-object.js
index 20adbe3e05..08a0f0154d 100644
--- a/test/built-ins/Function/prototype/toString/setter-object.js
+++ b/test/built-ins/Function/prototype/toString/setter-object.js
@@ -4,6 +4,7 @@
 /*---
 esid: sec-method-definitions-runtime-semantics-propertydefinitionevaluation
 description: Function.prototype.toString on a setter (object)
+includes: [nativeFunctionMatcher.js]
 ---*/
 
 let x = "h";
@@ -11,6 +12,6 @@ let f = Object.getOwnPropertyDescriptor({ /* before */set /* a */ f /* b */ ( /*
 let g = Object.getOwnPropertyDescriptor({ /* before */set /* a */ [ /* b */ "g" /* c */ ] /* d */ ( /* e */ a /* f */ ) /* g */ { /* h */ }/* after */ }, "g").set;
 let h = Object.getOwnPropertyDescriptor({ /* before */set /* a */ [ /* b */ x /* c */ ] /* d */ ( /* e */ a /* f */ ) /* g */ { /* h */ }/* after */ }, "h").set;
 
-assert.sameValue(f.toString(), "set /* a */ f /* b */ ( /* c */ a /* d */ ) /* e */ { /* f */ }");
-assert.sameValue(g.toString(), "set /* a */ [ /* b */ \"g\" /* c */ ] /* d */ ( /* e */ a /* f */ ) /* g */ { /* h */ }");
-assert.sameValue(h.toString(), "set /* a */ [ /* b */ x /* c */ ] /* d */ ( /* e */ a /* f */ ) /* g */ { /* h */ }");
+assertToStringOrNativeFunction(f, "set /* a */ f /* b */ ( /* c */ a /* d */ ) /* e */ { /* f */ }");
+assertToStringOrNativeFunction(g, "set /* a */ [ /* b */ \"g\" /* c */ ] /* d */ ( /* e */ a /* f */ ) /* g */ { /* h */ }");
+assertToStringOrNativeFunction(h, "set /* a */ [ /* b */ x /* c */ ] /* d */ ( /* e */ a /* f */ ) /* g */ { /* h */ }");
diff --git a/test/built-ins/Function/prototype/toString/unicode.js b/test/built-ins/Function/prototype/toString/unicode.js
index fa176fac29..d7addb1cf2 100644
--- a/test/built-ins/Function/prototype/toString/unicode.js
+++ b/test/built-ins/Function/prototype/toString/unicode.js
@@ -7,8 +7,9 @@ description: Function.prototype.toString on a function with Unicode escape seque
 info: |
   Function.prototype.toString returns a slice of the source text before
   any potential Unicode escape sequence substitution in identifiers
+includes: [nativeFunctionMatcher.js]
 ---*/
 
 function \u0061(\u{62}, \u0063) { \u0062 = \u{00063}; return b; }
 
-assert.sameValue(a.toString(), "function \\u0061(\\u{62}, \\u0063) { \\u0062 = \\u{00063}; return b; }");
+assertToStringOrNativeFunction(a, "function \\u0061(\\u{62}, \\u0063) { \\u0062 = \\u{00063}; return b; }");
-- 
GitLab