aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2017-05-08 06:23:01 +0800
committerGitHub <noreply@github.com>2017-05-08 06:23:01 +0800
commitda295de82bfa9e1df39f45ee54e8e11ecce5dfb2 (patch)
treee69d9df85be707b0138bfc3602f5edd7382bb26c /test
parent4f8ca4626efb15dc986785c89c51cbb3061e5f32 (diff)
downloadtracifyjs-da295de82bfa9e1df39f45ee54e8e11ecce5dfb2.tar.gz
tracifyjs-da295de82bfa9e1df39f45ee54e8e11ecce5dfb2.zip
support dumping AST (#1879)
Re-order `AST_Binary` properties to make dump more readable. closes #769
Diffstat (limited to 'test')
-rw-r--r--test/mocha/cli.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/mocha/cli.js b/test/mocha/cli.js
index cac920d3..8c7964ac 100644
--- a/test/mocha/cli.js
+++ b/test/mocha/cli.js
@@ -509,4 +509,15 @@ describe("bin/uglifyjs", function () {
return JSON.stringify(map).replace(/"/g, '\\"');
}
});
+ it("Should dump AST as JSON", function(done) {
+ var command = uglifyjscmd + " test/input/global_defs/simple.js -mco ast";
+ exec(command, function (err, stdout) {
+ if (err) throw err;
+
+ var ast = JSON.parse(stdout);
+ assert.strictEqual(ast._class, "AST_Toplevel");
+ assert.ok(Array.isArray(ast.body));
+ done();
+ });
+ });
});