aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/drop-console.js2
-rw-r--r--test/compress/hoist_vars.js90
-rw-r--r--test/compress/negate-iife.js6
3 files changed, 94 insertions, 4 deletions
diff --git a/test/compress/drop-console.js b/test/compress/drop-console.js
index 162b339c..2333722f 100644
--- a/test/compress/drop-console.js
+++ b/test/compress/drop-console.js
@@ -10,7 +10,7 @@ drop_console_1: {
}
}
-drop_console_1: {
+drop_console_2: {
options = { drop_console: true };
input: {
console.log('foo');
diff --git a/test/compress/hoist_vars.js b/test/compress/hoist_vars.js
new file mode 100644
index 00000000..6fe1c773
--- /dev/null
+++ b/test/compress/hoist_vars.js
@@ -0,0 +1,90 @@
+statements: {
+ options = {
+ hoist_funs: false,
+ hoist_vars: true,
+ }
+ input: {
+ function f() {
+ var a = 1;
+ var b = 2;
+ var c = 3;
+ function g() {}
+ return g(a, b, c);
+ }
+ }
+ expect: {
+ function f() {
+ var a = 1, b = 2, c = 3;
+ function g() {}
+ return g(a, b, c);
+ }
+ }
+}
+
+statements_funs: {
+ options = {
+ hoist_funs: true,
+ hoist_vars: true,
+ }
+ input: {
+ function f() {
+ var a = 1;
+ var b = 2;
+ var c = 3;
+ function g() {}
+ return g(a, b, c);
+ }
+ }
+ expect: {
+ function f() {
+ function g() {}
+ var a = 1, b = 2, c = 3;
+ return g(a, b, c);
+ }
+ }
+}
+
+sequences: {
+ options = {
+ hoist_funs: false,
+ hoist_vars: true,
+ }
+ input: {
+ function f() {
+ var a = 1, b = 2;
+ function g() {}
+ var c = 3;
+ return g(a, b, c);
+ }
+ }
+ expect: {
+ function f() {
+ var c, a = 1, b = 2;
+ function g() {}
+ c = 3;
+ return g(a, b, c);
+ }
+ }
+}
+
+sequences_funs: {
+ options = {
+ hoist_funs: true,
+ hoist_vars: true,
+ }
+ input: {
+ function f() {
+ var a = 1, b = 2;
+ function g() {}
+ var c = 3;
+ return g(a, b, c);
+ }
+ }
+ expect: {
+ function f() {
+ function g() {}
+ var a = 1, b = 2, c = 3;
+ return g(a, b, c);
+ }
+ }
+}
diff --git a/test/compress/negate-iife.js b/test/compress/negate-iife.js
index 312e0f28..001795c5 100644
--- a/test/compress/negate-iife.js
+++ b/test/compress/negate-iife.js
@@ -58,7 +58,7 @@ negate_iife_3_off: {
}
}
-negate_iife_3: {
+negate_iife_4: {
options = {
negate_iife: true,
conditionals: true,
@@ -112,7 +112,7 @@ sequence_off: {
}
}
-negate_iife_4: {
+negate_iife_5: {
options = {
negate_iife: true,
sequences: true,
@@ -135,7 +135,7 @@ negate_iife_4: {
}
}
-negate_iife_4_off: {
+negate_iife_5_off: {
options = {
negate_iife: false,
sequences: true,