From 0ccbceb9e86b2008b3c4d7f744050f7a10aed00d Mon Sep 17 00:00:00 2001 From: Daniel Tschinder Date: Mon, 25 Apr 2016 15:41:43 +0200 Subject: [PATCH] Ensure strictmode is enabled/disabled when changing sourceType (babel/babel-eslint#302) --- .../babel-eslint-parser/test/non-regression.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index f88ba58cef..593cc49239 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -1428,6 +1428,23 @@ describe("verify", function () { ); }); + it("with does not crash parsing in script mode (strict off) #171", function () { + verifyAndAssertMessages( + "with (arguments) { length; }", + {}, + [], + "script" + ); + }); + + it("with does crash parsing in module mode (strict on) #171", function () { + verifyAndAssertMessages( + "with (arguments) { length; }", + {}, + [ "1:1 Parsing error: 'with' in strict mode" ] + ); + }); + // it("regex with es6 unicodeCodePointEscapes", function () { // verifyAndAssertMessages( // "string.replace(/[\u{0000A0}-\u{10FFFF}<>\&]/gmiu, (char) => `&#x${char.codePointAt(0).toString(16)};`);",