Files
UglifyJS/test/mocha/with.js
Anthony Van de Gejuchte 6c99816855 Normalize error messages
2016-06-19 21:08:34 +02:00

16 lines
571 B
JavaScript

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);
});
});