diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /js/src/tests/ecma_6/Class/newTargetMethods.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/tests/ecma_6/Class/newTargetMethods.js')
-rw-r--r-- | js/src/tests/ecma_6/Class/newTargetMethods.js | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/js/src/tests/ecma_6/Class/newTargetMethods.js b/js/src/tests/ecma_6/Class/newTargetMethods.js new file mode 100644 index 000000000..2383dc8bd --- /dev/null +++ b/js/src/tests/ecma_6/Class/newTargetMethods.js @@ -0,0 +1,51 @@ +// Just like newTargetDirectInvoke, except to prove it works in functions +// defined with method syntax as well. Note that methods, getters, and setters +// are not constructible. + +let ol = { + olTest(arg) { assertEq(arg, 4); assertEq(new.target, undefined); }, + get ol() { assertEq(new.target, undefined); }, + set ol(arg) { assertEq(arg, 4); assertEq(new.target, undefined); } +} + +class cl { + constructor() { assertEq(new.target, cl); } + clTest(arg) { assertEq(arg, 4); assertEq(new.target, undefined); } + get cl() { assertEq(new.target, undefined); } + set cl(arg) { assertEq(arg, 4); assertEq(new.target, undefined); } + + static staticclTest(arg) { assertEq(arg, 4); assertEq(new.target, undefined); } + static get staticcl() { assertEq(new.target, undefined); } + static set staticcl(arg) { assertEq(arg, 4); assertEq(new.target, undefined); } +} + +const TEST_ITERATIONS = 150; + +for (let i = 0; i < TEST_ITERATIONS; i++) + ol.olTest(4); +for (let i = 0; i < TEST_ITERATIONS; i++) + ol.ol; +for (let i = 0; i < TEST_ITERATIONS; i++) + ol.ol = 4; + +for (let i = 0; i < TEST_ITERATIONS; i++) + cl.staticclTest(4); +for (let i = 0; i < TEST_ITERATIONS; i++) + cl.staticcl; +for (let i = 0; i < TEST_ITERATIONS; i++) + cl.staticcl = 4; + +for (let i = 0; i < TEST_ITERATIONS; i++) + new cl(); + +let clInst = new cl(); + +for (let i = 0; i < TEST_ITERATIONS; i++) + clInst.clTest(4); +for (let i = 0; i < TEST_ITERATIONS; i++) + clInst.cl; +for (let i = 0; i < TEST_ITERATIONS; i++) + clInst.cl = 4; + +if (typeof reportCompare === "function") + reportCompare(0,0,"OK"); |