- refactor `screw_ie8` to `ie8` - compact `sourceMap` options - more stringent verification on input `options` - toplevel shorthands - `ie8` - `keep_fnames` - `toplevel` - deprecated `fromString` in `minify()` - `minify()` no longer handles any `fs` operations - unify order of operations for `mangle_properties()` on CLI & API - `bin/uglifyjs` used to `mangle_properties()` before even `Compressor` - `minify()` used to `mangle_properties()` after `Compressor` but before `mangle_names()` - both will now do `Compressor`, `mangle_names()` then `mangle_properties()` - `options.parse` / `--parse` for parser options beyond `bare_returns` closes #96 closes #1366 fixes #124 fixes #263 fixes #379 fixes #423 fixes #576 fixes #737 fixes #958 fixes #1036 fixes #1175 fixes #1220 fixes #1223 fixes #1280
51 lines
1.6 KiB
JavaScript
51 lines
1.6 KiB
JavaScript
var assert = require("assert");
|
|
var uglify = require("../../");
|
|
|
|
describe("Comment", function() {
|
|
it("Should recognize eol of single line comments", function() {
|
|
var tests = [
|
|
"//Some comment 1\n>",
|
|
"//Some comment 2\r>",
|
|
"//Some comment 3\r\n>",
|
|
"//Some comment 4\u2028>",
|
|
"//Some comment 5\u2029>"
|
|
];
|
|
|
|
var fail = function(e) {
|
|
return e instanceof uglify.JS_Parse_Error &&
|
|
e.message === "Unexpected token: operator (>)" &&
|
|
e.line === 2 &&
|
|
e.col === 0;
|
|
}
|
|
|
|
for (var i = 0; i < tests.length; i++) {
|
|
assert.throws(function() {
|
|
uglify.parse(tests[i]);
|
|
}, fail, tests[i]);
|
|
}
|
|
});
|
|
|
|
it("Should update the position of a multiline comment correctly", function() {
|
|
var tests = [
|
|
"/*Some comment 1\n\n\n*/\n>\n\n\n\n\n\n",
|
|
"/*Some comment 2\r\n\r\n\r\n*/\r\n>\n\n\n\n\n\n",
|
|
"/*Some comment 3\r\r\r*/\r>\n\n\n\n\n\n",
|
|
"/*Some comment 4\u2028\u2028\u2028*/\u2028>\n\n\n\n\n\n",
|
|
"/*Some comment 5\u2029\u2029\u2029*/\u2029>\n\n\n\n\n\n"
|
|
];
|
|
|
|
var fail = function(e) {
|
|
return e instanceof uglify.JS_Parse_Error &&
|
|
e.message === "Unexpected token: operator (>)" &&
|
|
e.line === 5 &&
|
|
e.col === 0;
|
|
}
|
|
|
|
for (var i = 0; i < tests.length; i++) {
|
|
assert.throws(function() {
|
|
uglify.parse(tests[i]);
|
|
}, fail, tests[i]);
|
|
}
|
|
});
|
|
});
|