diff options
author | Richard van Velzen <rvanvelzen@experty.com> | 2016-04-26 11:49:55 +0200 |
---|---|---|
committer | Richard van Velzen <rvanvelzen@experty.com> | 2016-04-26 11:49:55 +0200 |
commit | e9224ab4441ddb352566a52b84f1384bf5b8a8d8 (patch) | |
tree | 3fd4a4743fe837f53f8a62d90bbf38b089a9eefa /test/compress/issue-1052.js | |
parent | 4d9a0856870fc8feb07771fe2e27d93c8613e857 (diff) | |
download | tracifyjs-e9224ab4441ddb352566a52b84f1384bf5b8a8d8.tar.gz tracifyjs-e9224ab4441ddb352566a52b84f1384bf5b8a8d8.zip |
Add test cases for slightly more esoteric cases
Diffstat (limited to 'test/compress/issue-1052.js')
-rw-r--r-- | test/compress/issue-1052.js | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/test/compress/issue-1052.js b/test/compress/issue-1052.js index bad28a8f..0a77f006 100644 --- a/test/compress/issue-1052.js +++ b/test/compress/issue-1052.js @@ -41,3 +41,56 @@ single_function: { } )(); } } + +deeply_nested: { + options = { if_return: true, hoist_funs: false }; + input: { + ( function() { + if ( !window ) { + return; + } + + function f() {} + function g() {} + + if ( !document ) { + return; + } + + function h() {} + } )(); + } + expect: { + ( function() { + function f() {} + function g() {} + + function h() {} + + // NOTE: other compression steps will reduce this + // down to just `window`. + if ( window ) + if (document); + } )(); + } +} + +not_hoisted_when_already_nested: { + options = { if_return: true, hoist_funs: false }; + input: { + ( function() { + if ( !window ) { + return; + } + + if ( foo ) function f() {} + + } )(); + } + expect: { + ( function() { + if ( window ) + if ( foo ) function f() {} + } )(); + } +} |