Skip to content

Commit

Permalink
Add tests for .toString() of private methods (#2268)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkubilayk authored and leobalter committed Aug 5, 2019
1 parent aae991d commit 9b29709
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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 */ }");
Original file line number Diff line number Diff line change
@@ -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 */ }");
Original file line number Diff line number Diff line change
@@ -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 */ }");
Original file line number Diff line number Diff line change
@@ -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 */ }");

0 comments on commit 9b29709

Please sign in to comment.