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_5/strict/rebind-eval-should-fail-in-strict-mode.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_5/strict/rebind-eval-should-fail-in-strict-mode.js')
-rw-r--r-- | js/src/tests/ecma_5/strict/rebind-eval-should-fail-in-strict-mode.js | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/js/src/tests/ecma_5/strict/rebind-eval-should-fail-in-strict-mode.js b/js/src/tests/ecma_5/strict/rebind-eval-should-fail-in-strict-mode.js new file mode 100644 index 000000000..41f007627 --- /dev/null +++ b/js/src/tests/ecma_5/strict/rebind-eval-should-fail-in-strict-mode.js @@ -0,0 +1,39 @@ +/* + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/licenses/publicdomain/ + */ + +var BadSyntaxStrings = [ + "function foo1() { \"use strict\"; try {} catch (eval) {} }", + "function foo2() { \"use strict\"; let eval = 9; foo(); }", + "function foo3() { \"use strict\"; for (let eval = 3;;) { foo(); }}", + "function foo4() { \"use strict\"; for (let eval in {a:1}) { foo(); }}", + "function foo5() { \"use strict\"; for (let eval of [1, 2, 3]) { foo(); }}", + "function foo6() { \"use strict\"; var eval = 12; }", + "function foo7() { \"use strict\"; for (var eval = 3;;) { foo(); }}", + "function foo8() { \"use strict\"; for (var eval in {a:1}) { foo(); }}", + "function foo9() { \"use strict\"; for (var eval of [1, 2, 3]) { foo(); }}", + "function foo10() { \"use strict\"; const eval = 12; }", + "function foo11() { \"use strict\"; for (const eval = 3;;) { foo(); }}", + "function foo12() { \"use strict\"; return [eval for (eval of [1, 2, 3])]; }", + "function foo13() { \"use strict\"; return [eval for (eval in {a:3})]; }", + "function foo14() { \"use strict\"; return (eval for (eval of [1, 2, 3])); }", + "function foo15() { \"use strict\"; return (eval for (eval in {a:3})); }" +]; + +function testString(s, i) { + var gotSyntaxError = -1; + try { + eval(s); + } catch(err) { + if (err instanceof SyntaxError) + gotSyntaxError = i; + } + + assertEq(gotSyntaxError, i); +} + +for (var i = 0; i < BadSyntaxStrings.length; i++) + testString(BadSyntaxStrings[i], i); + +reportCompare(true, true); |