diff options
Diffstat (limited to 'test/mocha')
-rw-r--r-- | test/mocha/cli.js | 24 | ||||
-rw-r--r-- | test/mocha/comments.js | 4 | ||||
-rw-r--r-- | test/mocha/directives.js | 2 | ||||
-rw-r--r-- | test/mocha/getter-setter.js | 2 | ||||
-rw-r--r-- | test/mocha/minify.js | 6 |
5 files changed, 23 insertions, 15 deletions
diff --git a/test/mocha/cli.js b/test/mocha/cli.js index 1e27f64e..af537f37 100644 --- a/test/mocha/cli.js +++ b/test/mocha/cli.js @@ -257,7 +257,7 @@ describe("bin/uglifyjs", function() { assert.strictEqual(lines[0], "Parse error at test/input/invalid/simple.js:1,12"); assert.strictEqual(lines[1], "function f(a{}"); assert.strictEqual(lines[2], " ^"); - assert.strictEqual(lines[3], "ERROR: Unexpected token punc «{», expected punc «,»"); + assert.strictEqual(lines[3], "ERROR: Unexpected token: punc «{», expected: punc «,»"); done(); }); }); @@ -281,7 +281,7 @@ describe("bin/uglifyjs", function() { assert.strictEqual(lines[0], "Parse error at test/input/invalid/eof.js:2,0"); assert.strictEqual(lines[1], "foo, bar("); assert.strictEqual(lines[2], " ^"); - assert.strictEqual(lines[3], "ERROR: Unexpected token: eof (undefined)"); + assert.strictEqual(lines[3], "ERROR: Unexpected token: eof"); done(); }); }); @@ -293,7 +293,7 @@ describe("bin/uglifyjs", function() { assert.strictEqual(lines[0], "Parse error at test/input/invalid/loop-no-body.js:2,0"); assert.strictEqual(lines[1], "for (var i = 0; i < 1; i++) "); assert.strictEqual(lines[2], " ^"); - assert.strictEqual(lines[3], "ERROR: Unexpected token: eof (undefined)"); + assert.strictEqual(lines[3], "ERROR: Unexpected token: eof"); done(); }); }); @@ -362,7 +362,7 @@ describe("bin/uglifyjs", function() { "Parse error at test/input/invalid/dot_1.js:1,2", "a.=", " ^", - "ERROR: Unexpected token: operator (=)" + "ERROR: Unexpected token: operator «=», expected: name" ].join("\n")); done(); }); @@ -376,7 +376,7 @@ describe("bin/uglifyjs", function() { "Parse error at test/input/invalid/dot_2.js:1,0", "%.a;", "^", - "ERROR: Unexpected token: operator (%)" + "ERROR: Unexpected token: operator «%»" ].join("\n")); done(); }); @@ -390,7 +390,7 @@ describe("bin/uglifyjs", function() { "Parse error at test/input/invalid/dot_3.js:1,2", "a./();", " ^", - "ERROR: Unexpected token: operator (/)" + "ERROR: Unexpected token: operator «/», expected: name" ].join("\n")); done(); }); @@ -404,7 +404,7 @@ describe("bin/uglifyjs", function() { "Parse error at test/input/invalid/object.js:1,13", "console.log({%: 1});", " ^", - "ERROR: Unexpected token: operator (%)" + "ERROR: Unexpected token: operator «%»" ].join("\n")); done(); }); @@ -502,7 +502,7 @@ describe("bin/uglifyjs", function() { "Parse error at test/input/invalid/else.js:1,7", "if (0) else 1;", " ^", - "ERROR: Unexpected token: keyword (else)" + "ERROR: Unexpected token: keyword «else»" ].join("\n")); done(); }); @@ -633,6 +633,14 @@ describe("bin/uglifyjs", function() { done(); }); }); + it("Should work with mangle.properties.regex from --config-file", function(done) { + var command = uglifyjscmd + " test/input/issue-3315/input.js --config-file test/input/issue-3315/config.json"; + exec(command, function(err, stdout) { + if (err) throw err; + assert.strictEqual(stdout, 'function f(){"aaaaaaaaaa";var a={prop:1,a:2};return a.prop+a.a}\n'); + done(); + }); + }); it("Should fail with --define a-b", function(done) { var command = uglifyjscmd + " test/input/issue-505/input.js --define a-b"; exec(command, function(err, stdout, stderr) { diff --git a/test/mocha/comments.js b/test/mocha/comments.js index b350a406..1ca1432a 100644 --- a/test/mocha/comments.js +++ b/test/mocha/comments.js @@ -13,7 +13,7 @@ describe("comments", function() { var fail = function(e) { return e instanceof UglifyJS.JS_Parse_Error - && e.message === "Unexpected token: operator (>)" + && e.message === "Unexpected token: operator «>»" && e.line === 2 && e.col === 0; } @@ -36,7 +36,7 @@ describe("comments", function() { var fail = function(e) { return e instanceof UglifyJS.JS_Parse_Error - && e.message === "Unexpected token: operator (>)" + && e.message === "Unexpected token: operator «>»" && e.line === 5 && e.col === 0; } diff --git a/test/mocha/directives.js b/test/mocha/directives.js index 65da6da5..74660dc6 100644 --- a/test/mocha/directives.js +++ b/test/mocha/directives.js @@ -146,7 +146,7 @@ describe("Directives", function() { UglifyJS.parse(tokenizer); }, function(e) { return e instanceof UglifyJS.JS_Parse_Error - && e.message === "Unexpected token: punc (])" + && /^Unexpected token: punc «]»/.test(e.message) }, test[0]); test[1].forEach(function(directive) { assert.strictEqual(tokenizer.has_directive(directive), true, directive + " in " + test[0]); diff --git a/test/mocha/getter-setter.js b/test/mocha/getter-setter.js index 84e7e30d..ec811aa1 100644 --- a/test/mocha/getter-setter.js +++ b/test/mocha/getter-setter.js @@ -69,7 +69,7 @@ describe("Getters and setters", function() { var fail = function(data) { return function(e) { return e instanceof UglifyJS.JS_Parse_Error - && e.message === "Unexpected token: operator (" + data.operator + ")"; + && e.message === "Unexpected token: operator «" + data.operator + "»"; }; }; var errorMessage = function(data) { diff --git a/test/mocha/minify.js b/test/mocha/minify.js index c580e59c..6e6c7a78 100644 --- a/test/mocha/minify.js +++ b/test/mocha/minify.js @@ -119,7 +119,7 @@ describe("minify", function() { it("Should not parse invalid use of reserved words", function() { assert.strictEqual(UglifyJS.minify("function enum(){}").error, undefined); assert.strictEqual(UglifyJS.minify("function static(){}").error, undefined); - assert.strictEqual(UglifyJS.minify("function this(){}").error.message, "Unexpected token: name (this)"); + assert.strictEqual(UglifyJS.minify("function this(){}").error.message, "Unexpected token: name «this»"); }); describe("keep_quoted_props", function() { @@ -214,7 +214,7 @@ describe("minify", function() { var result = UglifyJS.minify("function f(a{}"); var err = result.error; assert.ok(err instanceof Error); - assert.strictEqual(err.stack.split(/\n/)[0], "SyntaxError: Unexpected token punc «{», expected punc «,»"); + assert.strictEqual(err.stack.split(/\n/)[0], "SyntaxError: Unexpected token: punc «{», expected: punc «,»"); assert.strictEqual(err.filename, "0"); assert.strictEqual(err.line, 1); assert.strictEqual(err.col, 12); @@ -241,7 +241,7 @@ describe("minify", function() { }); var err = result.error; assert.ok(err instanceof Error); - assert.strictEqual(err.stack.split(/\n/)[0], "SyntaxError: Unexpected token: keyword (debugger)"); + assert.strictEqual(err.stack.split(/\n/)[0], "SyntaxError: Unexpected token: keyword «debugger»"); }); it("Should skip inherited properties", function() { var foo = Object.create({ skip: this }); |