diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2017-05-08 06:23:01 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-08 06:23:01 +0800 |
commit | da295de82bfa9e1df39f45ee54e8e11ecce5dfb2 (patch) | |
tree | e69d9df85be707b0138bfc3602f5edd7382bb26c /test | |
parent | 4f8ca4626efb15dc986785c89c51cbb3061e5f32 (diff) | |
download | tracifyjs-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.js | 11 |
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(); + }); + }); }); |