aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/compress/functions.js2
-rw-r--r--test/compress/let.js108
2 files changed, 109 insertions, 1 deletions
diff --git a/test/compress/functions.js b/test/compress/functions.js
index 8ab7c1fc..988f589e 100644
--- a/test/compress/functions.js
+++ b/test/compress/functions.js
@@ -5236,7 +5236,7 @@ issue_4265: {
expect: {
function f() {
return console, function() {
- return console.log(a);
+ console.log(a);
var a;
}(), 0;
}
diff --git a/test/compress/let.js b/test/compress/let.js
index 64526aa7..0a23f65b 100644
--- a/test/compress/let.js
+++ b/test/compress/let.js
@@ -569,6 +569,38 @@ loop_block_2: {
node_version: ">=4"
}
+do_break: {
+ options = {
+ loops: true,
+ }
+ input: {
+ "use strict";
+ try {
+ do {
+ if (a)
+ break;
+ let a;
+ } while (!console);
+ } catch (e) {
+ console.log("PASS");
+ }
+ }
+ expect: {
+ "use strict";
+ try {
+ do {
+ if (a)
+ break;
+ let a;
+ } while (!console);
+ } catch (e) {
+ console.log("PASS");
+ }
+ }
+ expect_stdout: "PASS"
+ node_version: ">=4"
+}
+
do_continue: {
options = {
loops: true,
@@ -629,6 +661,82 @@ dead_block_after_return: {
node_version: ">=4"
}
+if_return_1: {
+ options = {
+ if_return: true,
+ }
+ input: {
+ "use strict";
+ function f(a) {
+ function g() {
+ return b = "PASS";
+ }
+ if (a)
+ return g();
+ let b;
+ return g();
+ };
+ console.log(f());
+ }
+ expect: {
+ "use strict";
+ function f(a) {
+ function g() {
+ return b = "PASS";
+ }
+ if (a)
+ return g();
+ let b;
+ return g();
+ };
+ console.log(f());
+ }
+ expect_stdout: "PASS"
+ node_version: ">=4"
+}
+
+if_return_2: {
+ options = {
+ if_return: true,
+ }
+ input: {
+ "use strict";
+ function f(a) {
+ function g() {
+ return b = "FAIL";
+ }
+ if (a)
+ return g();
+ let b;
+ return g();
+ };
+ try {
+ console.log(f(42));
+ } catch (e) {
+ console.log("PASS");
+ }
+ }
+ expect: {
+ "use strict";
+ function f(a) {
+ function g() {
+ return b = "FAIL";
+ }
+ if (a)
+ return g();
+ let b;
+ return g();
+ };
+ try {
+ console.log(f(42));
+ } catch (e) {
+ console.log("PASS");
+ }
+ }
+ expect_stdout: "PASS"
+ node_version: ">=4"
+}
+
do_if_continue_1: {
options = {
if_return: true,