From 9b29709797ce94925f2ff398146eb21abcf04ebc Mon Sep 17 00:00:00 2001 From: Kubilay Kahveci Date: Mon, 5 Aug 2019 21:47:19 +0100 Subject: [PATCH] Add tests for .toString() of private methods (#2268) --- .../private-method-class-expression.js | 17 +++++++++++++++++ .../toString/private-method-class-statement.js | 18 ++++++++++++++++++ .../private-static-method-class-expression.js | 17 +++++++++++++++++ .../private-static-method-class-statement.js | 17 +++++++++++++++++ 4 files changed, 69 insertions(+) create mode 100644 test/built-ins/Function/prototype/toString/private-method-class-expression.js create mode 100644 test/built-ins/Function/prototype/toString/private-method-class-statement.js create mode 100644 test/built-ins/Function/prototype/toString/private-static-method-class-expression.js create mode 100644 test/built-ins/Function/prototype/toString/private-static-method-class-statement.js diff --git a/test/built-ins/Function/prototype/toString/private-method-class-expression.js b/test/built-ins/Function/prototype/toString/private-method-class-expression.js new file mode 100644 index 00000000000..1c8bc0b95da --- /dev/null +++ b/test/built-ins/Function/prototype/toString/private-method-class-expression.js @@ -0,0 +1,17 @@ +// Copyright (C) 2019 Kubilay Kahveci (Bloomberg LP). All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Function.prototype.toString on a private method +features: [class-methods-private] +includes: [nativeFunctionMatcher.js] +---*/ + +let c = new (class { + /* before */#f /* a */ ( /* b */ ) /* c */ { /* d */ }/* after */ + assert(expected) { + assertToStringOrNativeFunction(this.#f, expected); + } +}); + +c.assert("#f /* a */ ( /* b */ ) /* c */ { /* d */ }"); diff --git a/test/built-ins/Function/prototype/toString/private-method-class-statement.js b/test/built-ins/Function/prototype/toString/private-method-class-statement.js new file mode 100644 index 00000000000..cbd5a2b766f --- /dev/null +++ b/test/built-ins/Function/prototype/toString/private-method-class-statement.js @@ -0,0 +1,18 @@ +// Copyright (C) 2019 Kubilay Kahveci (Bloomberg LP). All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Function.prototype.toString on a private method +features: [class-methods-private] +includes: [nativeFunctionMatcher.js] +---*/ + +class C { + /* before */#f /* a */ ( /* b */ ) /* c */ { /* d */ }/* after */ + assert(expected) { + assertToStringOrNativeFunction(this.#f, expected); + } +} + +let c = new C(); +c.assert("#f /* a */ ( /* b */ ) /* c */ { /* d */ }"); diff --git a/test/built-ins/Function/prototype/toString/private-static-method-class-expression.js b/test/built-ins/Function/prototype/toString/private-static-method-class-expression.js new file mode 100644 index 00000000000..4ca9ddd2031 --- /dev/null +++ b/test/built-ins/Function/prototype/toString/private-static-method-class-expression.js @@ -0,0 +1,17 @@ +// Copyright (C) 2019 Kubilay Kahveci (Bloomberg LP). All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Function.prototype.toString on a static private method +features: [class-static-methods-private] +includes: [nativeFunctionMatcher.js] +---*/ + +let C = class { + /* before */static #f /* a */ ( /* b */ ) /* c */ { /* d */ }/* after */ + static assert(expected) { + assertToStringOrNativeFunction(this.#f, expected); + } +}; + +C.assert("#f /* a */ ( /* b */ ) /* c */ { /* d */ }"); diff --git a/test/built-ins/Function/prototype/toString/private-static-method-class-statement.js b/test/built-ins/Function/prototype/toString/private-static-method-class-statement.js new file mode 100644 index 00000000000..55d49d6d096 --- /dev/null +++ b/test/built-ins/Function/prototype/toString/private-static-method-class-statement.js @@ -0,0 +1,17 @@ +// Copyright (C) 2019 Kubilay Kahveci (Bloomberg LP). All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Function.prototype.toString on a static private method +features: [class-static-methods-private] +includes: [nativeFunctionMatcher.js] +---*/ + +class C { + /* before */static #f /* a */ ( /* b */ ) /* c */ { /* d */ }/* after */ + static assert(expected) { + assertToStringOrNativeFunction(this.#f, expected); + } +} + +C.assert("#f /* a */ ( /* b */ ) /* c */ { /* d */ }");