added tests
This commit is contained in:
parent
db73113599
commit
c0c42db007
|
|
@ -69,7 +69,7 @@ You need to pass an argument to this option to specify the name that your module
|
||||||
.describe("noerr", "Don't throw an error for unknown options in -c, -b or -m.")
|
.describe("noerr", "Don't throw an error for unknown options in -c, -b or -m.")
|
||||||
.describe("bare-returns", "Allow return outside of functions. Useful when minifying CommonJS modules.")
|
.describe("bare-returns", "Allow return outside of functions. Useful when minifying CommonJS modules.")
|
||||||
.describe("keep-fnames", "Do not mangle/drop function names. Useful for code relying on Function.prototype.name.")
|
.describe("keep-fnames", "Do not mangle/drop function names. Useful for code relying on Function.prototype.name.")
|
||||||
.describe("keep-fparens", "Do not drop parenthesises around function definitions. Useful for marking a function to be compiled eagerly by browser.")
|
.describe("keep-fparens", "Do not drop parentheses around function definitions. Useful for marking a function to be compiled eagerly by browser.")
|
||||||
.describe("quotes", "Quote style (0 - auto, 1 - single, 2 - double, 3 - original)")
|
.describe("quotes", "Quote style (0 - auto, 1 - single, 2 - double, 3 - original)")
|
||||||
.describe("reserved-file", "File containing reserved names")
|
.describe("reserved-file", "File containing reserved names")
|
||||||
.describe("reserve-domprops", "Make (most?) DOM properties reserved for --mangle-props")
|
.describe("reserve-domprops", "Make (most?) DOM properties reserved for --mangle-props")
|
||||||
|
|
|
||||||
25
test/mocha/wrapping-parentheses.js
Normal file
25
test/mocha/wrapping-parentheses.js
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
var assert = require("assert");
|
||||||
|
var uglify = require("../../");
|
||||||
|
|
||||||
|
describe("Keep wrapping parentheses", function() {
|
||||||
|
it("Should keep wrapping parentheses if keep-fparens option is turned on", function() {
|
||||||
|
var originalCode = "define(\"module\",(function() {module.exports = 42;}));";
|
||||||
|
var expectedCode = "define(\"module\",(function(){module.exports=42}));";
|
||||||
|
var result = uglify.minify(originalCode, {
|
||||||
|
output: {
|
||||||
|
keep_fparens: true
|
||||||
|
},
|
||||||
|
fromString: true
|
||||||
|
});
|
||||||
|
assert.strictEqual(result.code, expectedCode);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Should strip wrapping parentheses if keep-fparens option is turned off or not set", function() {
|
||||||
|
var originalCode = "define(\"module\",(function() {module.exports = 42;}));";
|
||||||
|
var expectedCode = "define(\"module\",function(){module.exports=42});";
|
||||||
|
var result = uglify.minify(originalCode, {
|
||||||
|
fromString: true
|
||||||
|
});
|
||||||
|
assert.strictEqual(result.code, expectedCode);
|
||||||
|
});
|
||||||
|
});
|
||||||
Loading…
Reference in New Issue
Block a user