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/jit-test/tests/basic/destructuring-rest-identifiers.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/jit-test/tests/basic/destructuring-rest-identifiers.js')
-rw-r--r-- | js/src/jit-test/tests/basic/destructuring-rest-identifiers.js | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/basic/destructuring-rest-identifiers.js b/js/src/jit-test/tests/basic/destructuring-rest-identifiers.js new file mode 100644 index 000000000..437a66668 --- /dev/null +++ b/js/src/jit-test/tests/basic/destructuring-rest-identifiers.js @@ -0,0 +1,73 @@ + +load(libdir + 'asserts.js'); +load(libdir + 'eqArrayHelper.js'); + +var reserved = [ + 'break', + 'do', + 'in', + 'typeof', + 'case', + 'else', + 'instanceof', + 'var', + 'catch', + 'export', + 'new', + 'void', + 'class', + 'extends', + 'return', + 'while', + 'const', + 'finally', + 'super', + 'with', + 'continue', + 'for', + 'switch', + 'debugger', + 'function', + 'this', + 'delete', + 'import', + 'try', + 'enum', + 'null', + 'true', + 'false' +]; +reserved.forEach(ident => { + assertThrowsInstanceOf(() => new Function('var [...' + ident + '] = []'), SyntaxError); +}); + +var strictIdentifiers = [ + // XXX: see bug 1032150. Once fixed, please uncomment these values and + // remove the assertions below + //'yield', + //'let', + 'eval', + 'arguments', + 'implements', + 'interface', + 'package', + 'private', + 'protected', + 'public', + 'static' +]; +assertThrowsInstanceOf(() => new Function('[...yield] = []'), SyntaxError); +assertThrowsInstanceOf(() => new Function('"use strict"; [...let] = []'), SyntaxError); + +strictIdentifiers.forEach(ident => + assertThrowsInstanceOf(() => + new Function('"use strict"; [...' + ident + '] = []'), SyntaxError)); + +var globalEval = eval; +strictIdentifiers.forEach(ident => { + globalEval(ident + ' = null'); + assertEqArray(new Function('input', '[, ...' + ident + '] = input;' + + 'return ' + ident + )([1, 2, 3]), [2, 3]); +}); + |