aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/compress/switch.js50
1 files changed, 50 insertions, 0 deletions
diff --git a/test/compress/switch.js b/test/compress/switch.js
index 6fde5dd3..62e39cf7 100644
--- a/test/compress/switch.js
+++ b/test/compress/switch.js
@@ -208,3 +208,53 @@ constant_switch_9: {
}
}
}
+
+drop_default_1: {
+ options = { dead_code: true };
+ input: {
+ switch (foo) {
+ case 'bar': baz();
+ default:
+ }
+ }
+ expect: {
+ switch (foo) {
+ case 'bar': baz();
+ }
+ }
+}
+
+drop_default_2: {
+ options = { dead_code: true };
+ input: {
+ switch (foo) {
+ case 'bar': baz(); break;
+ default:
+ break;
+ }
+ }
+ expect: {
+ switch (foo) {
+ case 'bar': baz();
+ }
+ }
+}
+
+keep_default: {
+ options = { dead_code: true };
+ input: {
+ switch (foo) {
+ case 'bar': baz();
+ default:
+ something();
+ break;
+ }
+ }
+ expect: {
+ switch (foo) {
+ case 'bar': baz();
+ default:
+ something();
+ }
+ }
+}