aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAnthony Van de Gejuchte <anthonyvdgent@gmail.com>2016-10-26 17:34:30 +0200
committerRichard van Velzen <rvanvelzen1@gmail.com>2016-11-29 20:24:08 +0100
commit79b98a9fe87f950607c601a45a3566a46c32f425 (patch)
tree43bd4aa1d97e2ee3d6fb3246a8d84fa23b8e192d /test
parent057de570e69b300ca472719cb234a32e593d34ec (diff)
downloadtracifyjs-79b98a9fe87f950607c601a45a3566a46c32f425.tar.gz
tracifyjs-79b98a9fe87f950607c601a45a3566a46c32f425.zip
Do not overwrite options.comments + cleanup
Diffstat (limited to 'test')
-rw-r--r--test/mocha/comment-filter.js12
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(){}");
+ });
});