[Pkg-javascript-commits] [uglifyjs] 226/491: more tests for #2351 (#2357)
Jonas Smedegaard
dr at jones.dk
Wed Feb 14 19:51:38 UTC 2018
This is an automated email from the git hooks/post-receive script.
js pushed a commit to annotated tag debian/3.3.10-1
in repository uglifyjs.
commit eba0f93bc025383379a8959368ca273aa562bdae
Author: Alex Lam S.L <alexlamsl at gmail.com>
Date: Thu Oct 12 02:58:25 2017 +0800
more tests for #2351 (#2357)
---
test/compress/reduce_vars.js | 80 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 80 insertions(+)
diff --git a/test/compress/reduce_vars.js b/test/compress/reduce_vars.js
index c1da299..d93f0cd 100644
--- a/test/compress/reduce_vars.js
+++ b/test/compress/reduce_vars.js
@@ -2814,3 +2814,83 @@ regex_loop: {
}
expect_stdout: true
}
+
+obj_for_1: {
+ options = {
+ reduce_vars: true,
+ toplevel: true,
+ unused: true,
+ }
+ input: {
+ var o = { a: 1 };
+ for (var i = o.a--; i; i--)
+ console.log(i);
+ }
+ expect: {
+ for (var i = { a: 1 }.a--; i; i--)
+ console.log(i);
+ }
+ expect_stdout: "1"
+}
+
+obj_for_2: {
+ options = {
+ reduce_vars: true,
+ toplevel: true,
+ unused: true,
+ }
+ input: {
+ var o = { a: 1 };
+ for (var i; i = o.a--;)
+ console.log(i);
+ }
+ expect: {
+ var o = { a: 1 };
+ for (var i; i = o.a--;)
+ console.log(i);
+ }
+ expect_stdout: "1"
+}
+
+array_forin_1: {
+ options = {
+ reduce_vars: true,
+ toplevel: true,
+ unused: true,
+ }
+ input: {
+ var a = [ 1, 2, 3 ];
+ for (var b in a)
+ console.log(b);
+ }
+ expect: {
+ for (var b in [ 1, 2, 3 ])
+ console.log(b);
+ }
+ expect_stdout: [
+ "0",
+ "1",
+ "2",
+ ]
+}
+
+array_forin_2: {
+ options = {
+ reduce_vars: true,
+ toplevel: true,
+ unused: true,
+ }
+ input: {
+ var a = [];
+ for (var b in [ 1, 2, 3 ])
+ a.push(b);
+ console.log(a.length);
+ }
+ expect: {
+ var a = [];
+ for (var b in [ 1, 2, 3 ])
+ a.push(b);
+ console.log(a.length);
+ }
+ expect_stdout: "3"
+}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/uglifyjs.git
More information about the Pkg-javascript-commits
mailing list