aboutsummaryrefslogtreecommitdiff
path: root/test/mocha/with.js
blob: 2e758d1eb0ad55ea945d387242e3b656af1c9a91 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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 === "SyntaxError: Strict mode may not include a with statement";
        }
        assert.throws(test, error);
    });
});