aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-10-05 10:28:46 +0100
committerGitHub <noreply@github.com>2020-10-05 17:28:46 +0800
commitb7a57fc69de453fb84bf8f192bdb1fdfa628ed5b (patch)
treee6102bf821ddee7e28cfea11608b8e7836303e7a /test
parent2dbe40b01bc0cc946974b911b9d30d90794851af (diff)
downloadtracifyjs-b7a57fc69de453fb84bf8f192bdb1fdfa628ed5b.tar.gz
tracifyjs-b7a57fc69de453fb84bf8f192bdb1fdfa628ed5b.zip
fix corner case in `loops` (#4183)
fixes #4182
Diffstat (limited to 'test')
-rw-r--r--test/compress/loops.js71
1 files changed, 71 insertions, 0 deletions
diff --git a/test/compress/loops.js b/test/compress/loops.js
index b8d351ad..1fa3d00c 100644
--- a/test/compress/loops.js
+++ b/test/compress/loops.js
@@ -1126,3 +1126,74 @@ issue_4091_2: {
}
expect_stdout: "undefined"
}
+
+issue_4182_1: {
+ options = {
+ loops: true,
+ }
+ input: {
+ (function() {
+ do {
+ try {
+ return;
+ } finally {
+ continue;
+ }
+ console.log("FAIL");
+ } while (0);
+ console.log("PASS");
+ })();
+ }
+ expect: {
+ (function() {
+ do {
+ try {
+ return;
+ } finally {
+ continue;
+ }
+ console.log("FAIL");
+ } while (0);
+ console.log("PASS");
+ })();
+ }
+ expect_stdout: "PASS"
+}
+
+issue_4182_2: {
+ options = {
+ loops: true,
+ }
+ input: {
+ (function() {
+ L: do {
+ do {
+ try {
+ return;
+ } finally {
+ continue L;
+ }
+ console.log("FAIL");
+ } while (0);
+ console.log("FAIL");
+ } while (0);
+ console.log("PASS");
+ })();
+ }
+ expect: {
+ (function() {
+ L: do {
+ do {
+ try {
+ return;
+ } finally {
+ continue L;
+ }
+ } while (console.log("FAIL"), 0);
+ console.log("FAIL");
+ } while (0);
+ console.log("PASS");
+ })();
+ }
+ expect_stdout: "PASS"
+}