aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-01-08 20:44:03 +0800
committerGitHub <noreply@github.com>2020-01-08 20:44:03 +0800
commit5d258259a492d1e04c952024d3d5662c65bb0ce6 (patch)
tree93bcf4fc17af21cef2ed4ec333a3e19444b4e5eb /test
parent14c35739ddb1c0b181d8c54566171f217014b563 (diff)
downloadtracifyjs-5d258259a492d1e04c952024d3d5662c65bb0ce6.tar.gz
tracifyjs-5d258259a492d1e04c952024d3d5662c65bb0ce6.zip
introduce `--output-opts` CLI option (#3678)
closes #3675
Diffstat (limited to 'test')
-rw-r--r--test/input/issue-1482/beautify.js17
-rw-r--r--test/input/issue-1482/default.js18
-rw-r--r--test/mocha/cli.js18
3 files changed, 35 insertions, 18 deletions
diff --git a/test/input/issue-1482/beautify.js b/test/input/issue-1482/beautify.js
new file mode 100644
index 00000000..14054e98
--- /dev/null
+++ b/test/input/issue-1482/beautify.js
@@ -0,0 +1,17 @@
+if (x) foo();
+
+if (x) foo(); else baz();
+
+if (x) foo(); else if (y) bar(); else baz();
+
+if (x) if (y) foo(); else bar(); else baz();
+
+if (x) foo(); else if (y) bar(); else if (z) baz(); else moo();
+
+function f() {
+ if (x) foo();
+ if (x) foo(); else baz();
+ if (x) foo(); else if (y) bar(); else baz();
+ if (x) if (y) foo(); else bar(); else baz();
+ if (x) foo(); else if (y) bar(); else if (z) baz(); else moo();
+}
diff --git a/test/input/issue-1482/default.js b/test/input/issue-1482/default.js
index 14054e98..505b30cc 100644
--- a/test/input/issue-1482/default.js
+++ b/test/input/issue-1482/default.js
@@ -1,17 +1 @@
-if (x) foo();
-
-if (x) foo(); else baz();
-
-if (x) foo(); else if (y) bar(); else baz();
-
-if (x) if (y) foo(); else bar(); else baz();
-
-if (x) foo(); else if (y) bar(); else if (z) baz(); else moo();
-
-function f() {
- if (x) foo();
- if (x) foo(); else baz();
- if (x) foo(); else if (y) bar(); else baz();
- if (x) if (y) foo(); else bar(); else baz();
- if (x) foo(); else if (y) bar(); else if (z) baz(); else moo();
-}
+if(x)foo();if(x)foo();else baz();if(x)foo();else if(y)bar();else baz();if(x)if(y)foo();else bar();else baz();if(x)foo();else if(y)bar();else if(z)baz();else moo();function f(){if(x)foo();if(x)foo();else baz();if(x)foo();else if(y)bar();else baz();if(x)if(y)foo();else bar();else baz();if(x)foo();else if(y)bar();else if(z)baz();else moo()}
diff --git a/test/mocha/cli.js b/test/mocha/cli.js
index dd181769..be7e9d23 100644
--- a/test/mocha/cli.js
+++ b/test/mocha/cli.js
@@ -176,7 +176,7 @@ describe("bin/uglifyjs", function() {
var command = uglifyjscmd + ' test/input/issue-1482/input.js -b';
exec(command, function(err, stdout) {
if (err) throw err;
- assert.strictEqual(stdout, read("test/input/issue-1482/default.js"));
+ assert.strictEqual(stdout, read("test/input/issue-1482/beautify.js"));
done();
});
});
@@ -188,6 +188,22 @@ describe("bin/uglifyjs", function() {
done();
});
});
+ it("Should work with `--output-opts`", function(done) {
+ var command = uglifyjscmd + ' test/input/issue-1482/input.js -O';
+ exec(command, function(err, stdout) {
+ if (err) throw err;
+ assert.strictEqual(stdout, read("test/input/issue-1482/default.js"));
+ done();
+ });
+ });
+ it("Should fail when both --beautify & --output-opts are specified", function(done) {
+ var command = uglifyjscmd + " test/input/issue-520/input.js -bO";
+ exec(command, function(err, stdout, stderr) {
+ assert.ok(err);
+ assert.strictEqual(stderr, "ERROR: --beautify cannot be used with --output-opts\n");
+ done();
+ });
+ });
it("Should process inline source map", function(done) {
var command = [
uglifyjscmd,