aboutsummaryrefslogtreecommitdiff
path: root/test/mocha/cli.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/mocha/cli.js')
-rw-r--r--test/mocha/cli.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/mocha/cli.js b/test/mocha/cli.js
index c5b571bd..64599c51 100644
--- a/test/mocha/cli.js
+++ b/test/mocha/cli.js
@@ -100,4 +100,34 @@ describe("bin/uglifyjs", function () {
done();
});
});
+ it("Should work with --define (simple)", function (done) {
+ var command = uglifyjscmd + ' test/input/global_defs/simple.js --define D=5 -c';
+
+ exec(command, function (err, stdout) {
+ if (err) throw err;
+
+ assert.strictEqual(stdout, "console.log(5);\n");
+ done();
+ });
+ });
+ it("Should work with --define (nested)", function (done) {
+ var command = uglifyjscmd + ' test/input/global_defs/nested.js --define C.D=5,C.V=3 -c';
+
+ exec(command, function (err, stdout) {
+ if (err) throw err;
+
+ assert.strictEqual(stdout, "console.log(3,5);\n");
+ done();
+ });
+ });
+ it("Should work with --define (AST_Node)", function (done) {
+ var command = uglifyjscmd + ' test/input/global_defs/simple.js --define console.log=stdout.println -c';
+
+ exec(command, function (err, stdout) {
+ if (err) throw err;
+
+ assert.strictEqual(stdout, "stdout.println(D);\n");
+ done();
+ });
+ });
});