Files
UglifyJS/test/mocha/object.js
Anthony Van de Gejuchte dcfc514c38 Improve yield support and restrict usage of strict
- Partially reverting 91cdb93e57 and eaf3911c31 and reimplement
- Add generators support for objects and classes
- Only classes can have static methods so restrict use of it

Special thanks to @rvanvelzen and @kzc for reviewing this patch and
providing constructive feedback over and over again.
2016-06-09 22:22:15 +02:00

20 lines
694 B
JavaScript

var Uglify = require("../../");
var assert = require("assert");
describe("Object", function() {
it ("Should allow objects to have a methodDefinition as property", function() {
var code = "var a = {test() {return true;}}";
assert.equal(Uglify.minify(code, {fromString: true}).code, "var a={test(){return!0}};");
});
it ("Should not allow objects to use static keywords like in classes", function() {
var code = "{static test() {}}";
var parse = function() {
Uglify.parse(code);
}
var expect = function(e) {
return e instanceof Uglify.JS_Parse_Error;
}
assert.throws(parse, expect);
});
});