aboutsummaryrefslogtreecommitdiff
path: root/test/mocha/with.js
diff options
context:
space:
mode:
authorAnthony Van de Gejuchte <anthonyvdgent@gmail.com>2016-06-12 18:58:20 +0200
committerAnthony Van de Gejuchte <anthonyvdgent@gmail.com>2016-06-12 19:08:16 +0200
commitbb9c9707aa6b4c625ad985798aea879080411ce1 (patch)
treedafd9b5d908ab28a352d6e31fefa29f1ad09a9b8 /test/mocha/with.js
parent6c8e001feeeb957279814aa58be44d1ece8bdb6e (diff)
downloadtracifyjs-bb9c9707aa6b4c625ad985798aea879080411ce1.tar.gz
tracifyjs-bb9c9707aa6b4c625ad985798aea879080411ce1.zip
Don't allow with statements in strict mode
Diffstat (limited to 'test/mocha/with.js')
-rw-r--r--test/mocha/with.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/mocha/with.js b/test/mocha/with.js
new file mode 100644
index 00000000..d284f1c2
--- /dev/null
+++ b/test/mocha/with.js
@@ -0,0 +1,16 @@
+var assert = require("assert");
+var uglify = require("../../");
+
+describe("With", function() {
+ it ("Should throw syntaxError when using with statement in strict mode", function() {
+ var code = '"use strict";\nthrow NotEarlyError;\nwith ({}) { }';
+ var test = function() {
+ uglify.parse(code);
+ }
+ var error = function(e) {
+ return e instanceof uglify.JS_Parse_Error &&
+ e.message === "Strict mode may not include a with statement";
+ }
+ assert.throws(test, error);
+ });
+}); \ No newline at end of file