program.option("--ie8", "Support non-standard Internet Explorer 8.");
program.option("--keep-fnames", "Do not mangle/drop function names. Useful for code relying on Function.prototype.name.");
program.option("--name-cache <file>", "File to hold mangled name mappings.");
+program.option("--rename", "Force symbol expansion.");
program.option("--no-rename", "Disable symbol expansion.");
program.option("--self", "Build UglifyJS as a library (implies --wrap UglifyJS)");
program.option("--source-map [options]", "Enable source map/specify source map options.", parse_source_map());
"compress",
"ie8",
"mangle",
- "rename",
"sourceMap",
"toplevel",
"wrap"
].forEach(function(name) {
if (name in program) {
- if (name == "rename" && program[name]) return;
options[name] = program[name];
}
});
fatal("ERROR: inline source map only works with built-in parser");
}
}
+if (~program.rawArgs.indexOf("--rename")) {
+ options.rename = true;
+} else if (!program.rename) {
+ options.rename = false;
+}
var convert_path = function(name) {
return name;
};
done();
});
});
+ it("Should work with explicit --rename", function(done) {
+ var command = uglifyjscmd + " test/input/rename/input.js --rename";
+ exec(command, function(err, stdout, stderr) {
+ if (err) throw err;
+ assert.strictEqual(stdout, "function f(a){return b(a);function b(c){return c}}\n");
+ done();
+ });
+ });
+ it("Should work with explicit --no-rename", function(done) {
+ var command = uglifyjscmd + " test/input/rename/input.js -mc --no-rename";
+ exec(command, function(err, stdout, stderr) {
+ if (err) throw err;
+ assert.strictEqual(stdout, "function f(n){return function(n){return n}(n)}\n");
+ done();
+ });
+ });
+ it("Should work with implicit --rename", function(done) {
+ var command = uglifyjscmd + " test/input/rename/input.js -mc";
+ exec(command, function(err, stdout, stderr) {
+ if (err) throw err;
+ assert.strictEqual(stdout, "function f(n){return n}\n");
+ done();
+ });
+ });
+ it("Should work with implicit --no-rename", function(done) {
+ var command = uglifyjscmd + " test/input/rename/input.js -c";
+ exec(command, function(err, stdout, stderr) {
+ if (err) throw err;
+ assert.strictEqual(stdout, "function f(x){return function(x){return x}(x)}\n");
+ done();
+ });
+ });
});