mirror of
https://github.com/tc39/test262.git
synced 2025-07-23 05:55:36 +02:00
Add tests for .toString() of private methods (#2268)
This commit is contained in:
parent
aae991da8a
commit
9b29709797
17
test/built-ins/Function/prototype/toString/private-method-class-expression.js
vendored
Normal file
17
test/built-ins/Function/prototype/toString/private-method-class-expression.js
vendored
Normal file
@ -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 */ }");
|
18
test/built-ins/Function/prototype/toString/private-method-class-statement.js
vendored
Normal file
18
test/built-ins/Function/prototype/toString/private-method-class-statement.js
vendored
Normal file
@ -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 */ }");
|
17
test/built-ins/Function/prototype/toString/private-static-method-class-expression.js
vendored
Normal file
17
test/built-ins/Function/prototype/toString/private-static-method-class-expression.js
vendored
Normal file
@ -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 */ }");
|
17
test/built-ins/Function/prototype/toString/private-static-method-class-statement.js
vendored
Normal file
17
test/built-ins/Function/prototype/toString/private-static-method-class-statement.js
vendored
Normal file
@ -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 */ }");
|
Loading…
x
Reference in New Issue
Block a user