Add test case for hoisting a single function
This commit is contained in:
@@ -1,8 +1,6 @@
|
|||||||
hoist_funs_when_handling_if_return_rerversal: {
|
multiple_functions: {
|
||||||
options = { if_return: true, hoist_funs: false };
|
options = { if_return: true, hoist_funs: false };
|
||||||
input: {
|
input: {
|
||||||
"use strict";
|
|
||||||
|
|
||||||
( function() {
|
( function() {
|
||||||
if ( !window ) {
|
if ( !window ) {
|
||||||
return;
|
return;
|
||||||
@@ -13,8 +11,6 @@ hoist_funs_when_handling_if_return_rerversal: {
|
|||||||
} )();
|
} )();
|
||||||
}
|
}
|
||||||
expect: {
|
expect: {
|
||||||
"use strict";
|
|
||||||
|
|
||||||
( function() {
|
( function() {
|
||||||
function f() {}
|
function f() {}
|
||||||
function g() {}
|
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 );
|
||||||
|
} )();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user