aboutsummaryrefslogtreecommitdiff
path: root/test/mocha
diff options
context:
space:
mode:
authorkzc <zaxxon2011@gmail.com>2016-04-15 19:58:46 -0400
committerkzc <zaxxon2011@gmail.com>2016-04-16 02:02:47 -0400
commite4fa4b109a0db5691d91b3dfba0eac41ac21c0ef (patch)
tree40980822a07bbc0baaa44032909278cee5c4734f /test/mocha
parent4b4528ee0552edb7ba1d24dad89e29880065e1c0 (diff)
downloadtracifyjs-e4fa4b109a0db5691d91b3dfba0eac41ac21c0ef.tar.gz
tracifyjs-e4fa4b109a0db5691d91b3dfba0eac41ac21c0ef.zip
Parse comments without recursion to avoid RangeError.
Fixes #993
Diffstat (limited to 'test/mocha')
-rw-r--r--test/mocha/huge-number-of-comments.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/mocha/huge-number-of-comments.js b/test/mocha/huge-number-of-comments.js
new file mode 100644
index 00000000..3b90bc0e
--- /dev/null
+++ b/test/mocha/huge-number-of-comments.js
@@ -0,0 +1,19 @@
+var Uglify = require('../../');
+var assert = require("assert");
+
+describe("Huge number of comments.", function() {
+ it("Should parse and compress code with thousands of consecutive comments", function() {
+ var js = 'function lots_of_comments(x) { return 7 -';
+ var i;
+ for (i = 1; i <= 5000; ++i) { js += "// " + i + "\n"; }
+ for (; i <= 10000; ++i) { js += "/* " + i + " */ /**/"; }
+ js += "x; }";
+ var result = Uglify.minify(js, {
+ fromString: true,
+ mangle: false,
+ compress: {}
+ });
+ assert.strictEqual(result.code, "function lots_of_comments(x){return 7-x}");
+ });
+});
+