diff options
author | Anthony Van de Gejuchte <anthonyvdgent@gmail.com> | 2016-10-26 17:34:30 +0200 |
---|---|---|
committer | Richard van Velzen <rvanvelzen1@gmail.com> | 2016-11-29 20:24:08 +0100 |
commit | 79b98a9fe87f950607c601a45a3566a46c32f425 (patch) | |
tree | 43bd4aa1d97e2ee3d6fb3246a8d84fa23b8e192d /test | |
parent | 057de570e69b300ca472719cb234a32e593d34ec (diff) | |
download | tracifyjs-79b98a9fe87f950607c601a45a3566a46c32f425.tar.gz tracifyjs-79b98a9fe87f950607c601a45a3566a46c32f425.zip |
Do not overwrite options.comments + cleanup
Diffstat (limited to 'test')
-rw-r--r-- | test/mocha/comment-filter.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/test/mocha/comment-filter.js b/test/mocha/comment-filter.js index 79162755..01580c87 100644 --- a/test/mocha/comment-filter.js +++ b/test/mocha/comment-filter.js @@ -2,7 +2,7 @@ var UglifyJS = require('../../'); var assert = require("assert"); describe("comment filters", function() { - it("Should be able to filter comments by passing regex", function() { + it("Should be able to filter comments by passing regexp", function() { var ast = UglifyJS.parse("/*!test1*/\n/*test2*/\n//!test3\n//test4\n<!--test5\n<!--!test6\n-->test7\n-->!test8"); assert.strictEqual(ast.print_to_string({comments: /^!/}), "/*!test1*/\n//!test3\n//!test6\n//!test8\n"); }); @@ -62,4 +62,14 @@ describe("comment filters", function() { var ast = UglifyJS.parse("#!foo\n//foo\n/*@preserve*/\n/* please hide me */"); assert.strictEqual(ast.print_to_string({comments: "some"}), "#!foo\n/*@preserve*/\n"); }); + + it("Should have no problem on multiple calls", function() { + const options = { + comments: /ok/ + }; + + assert.strictEqual(UglifyJS.parse("/* ok */ function a(){}").print_to_string(options), "/* ok */function a(){}"); + assert.strictEqual(UglifyJS.parse("/* ok */ function a(){}").print_to_string(options), "/* ok */function a(){}"); + assert.strictEqual(UglifyJS.parse("/* ok */ function a(){}").print_to_string(options), "/* ok */function a(){}"); + }); }); |