diff options
author | Richard van Velzen <rvanvelzen@experty.com> | 2016-04-26 11:43:03 +0200 |
---|---|---|
committer | Richard van Velzen <rvanvelzen@experty.com> | 2016-04-26 11:43:03 +0200 |
commit | 4d9a0856870fc8feb07771fe2e27d93c8613e857 (patch) | |
tree | 01bec6791b02cbbdf91a87925a84bd8236c45528 | |
parent | 4fe630431c37ffb81466959e9ea9797d6d2de21a (diff) | |
download | tracifyjs-4d9a0856870fc8feb07771fe2e27d93c8613e857.tar.gz tracifyjs-4d9a0856870fc8feb07771fe2e27d93c8613e857.zip |
Add test case for hoisting a single function
-rw-r--r-- | test/compress/issue-1052.js | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/test/compress/issue-1052.js b/test/compress/issue-1052.js index 067eea4a..bad28a8f 100644 --- a/test/compress/issue-1052.js +++ b/test/compress/issue-1052.js @@ -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 ); + } )(); + } +} |