Add test case for hoisting a single function
authorRichard van Velzen <rvanvelzen@experty.com>
Tue, 26 Apr 2016 09:43:03 +0000 (11:43 +0200)
committerRichard van Velzen <rvanvelzen@experty.com>
Tue, 26 Apr 2016 09:43:03 +0000 (11:43 +0200)
test/compress/issue-1052.js

index 067eea4..bad28a8 100644 (file)
@@ -1,8 +1,6 @@
-hoist_funs_when_handling_if_return_rerversal: {
+multiple_functions: {
     options = { if_return: true, hoist_funs: false };
     input: {
-        "use strict";
-
         ( function() {
             if ( !window ) {
                 return;
@@ -13,8 +11,6 @@ hoist_funs_when_handling_if_return_rerversal: {
         } )();
     }
     expect: {
-        "use strict";
-
         ( function() {
             function f() {}
             function g() {}
@@ -25,3 +21,23 @@ hoist_funs_when_handling_if_return_rerversal: {
         } )();
     }
 }
+
+single_function: {
+    options = { if_return: true, hoist_funs: false };
+    input: {
+        ( function() {
+            if ( !window ) {
+                return;
+            }
+
+            function f() {}
+        } )();
+    }
+    expect: {
+        ( function() {
+            function f() {}
+
+            if ( window );
+        } )();
+    }
+}