aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/awaits.js30
-rw-r--r--test/compress/sandbox.js49
2 files changed, 68 insertions, 11 deletions
diff --git a/test/compress/awaits.js b/test/compress/awaits.js
index 89d11bb9..4a90ca5e 100644
--- a/test/compress/awaits.js
+++ b/test/compress/awaits.js
@@ -612,22 +612,32 @@ issue_4340: {
call_expression: {
input: {
console.log(typeof async function(log) {
- (await log)("FAIL");
+ (await log)("foo");
}(console.log).then);
+ console.log("bar");
}
- expect_exact: 'console.log(typeof async function(log){(await log)("FAIL")}(console.log).then);'
- expect_stdout: "function"
+ expect_exact: 'console.log(typeof async function(log){(await log)("foo")}(console.log).then);console.log("bar");'
+ expect_stdout: [
+ "function",
+ "bar",
+ "foo",
+ ]
node_version: ">=8"
}
property_access_expression: {
input: {
console.log(typeof async function(con) {
- (await con).log("FAIL");
+ (await con).log("foo");
}(console).then);
+ console.log("bar");
}
- expect_exact: 'console.log(typeof async function(con){(await con).log("FAIL")}(console).then);'
- expect_stdout: "function"
+ expect_exact: 'console.log(typeof async function(con){(await con).log("foo")}(console).then);console.log("bar");'
+ expect_stdout: [
+ "function",
+ "bar",
+ "foo",
+ ]
node_version: ">=8"
}
@@ -685,20 +695,18 @@ reduce_iife_3: {
input: {
var a = "foo";
(async function() {
- console.log(a);
- console.log(await a);
+ console.log(a, await a, a, await a);
})();
a = "bar";
}
expect: {
var a = "foo";
(async function() {
- console.log(a);
- console.log(await a);
+ console.log(a, await a, a, await a);
})();
a = "bar";
}
- expect_stdout: "foo"
+ expect_stdout: "foo foo bar bar"
node_version: ">=8"
}
diff --git a/test/compress/sandbox.js b/test/compress/sandbox.js
index 9356f6f3..338afd11 100644
--- a/test/compress/sandbox.js
+++ b/test/compress/sandbox.js
@@ -13,6 +13,23 @@ console_log: {
]
}
+console_log_console: {
+ input: {
+ var log = console.log;
+ log(console);
+ log(typeof console.log);
+ }
+ expect: {
+ var log = console.log;
+ log(console);
+ log(typeof console.log);
+ }
+ expect_stdout: [
+ "{ log: 'function(){}' }",
+ "function",
+ ]
+}
+
typeof_arguments: {
options = {
evaluate: true,
@@ -81,6 +98,38 @@ log_global: {
expect_stdout: "[object global]"
}
+timers: {
+ options = {
+ reduce_vars: true,
+ toplevel: true,
+ unused: true,
+ }
+ input: {
+ var count = 0, interval = 1000, duration = 3210;
+ var timer = setInterval(function() {
+ console.log(++count);
+ }, interval);
+ setTimeout(function() {
+ clearInterval(timer);
+ }, duration);
+ }
+ expect: {
+ var count = 0;
+ var timer = setInterval(function() {
+ console.log(++count);
+ }, 1000);
+ setTimeout(function() {
+ clearInterval(timer);
+ }, 3210);
+ }
+ expect_stdout: [
+ "1",
+ "2",
+ "3",
+ ]
+ node_version: ">=0.12"
+}
+
issue_4054: {
input: {
console.log({