expand test options (#4475)
- fix corner cases in `hoist_vars` & `keep_fnames`
This commit is contained in:
@@ -32,6 +32,54 @@ defun_name: {
|
||||
node_version: ">=8"
|
||||
}
|
||||
|
||||
drop_fname: {
|
||||
rename = true
|
||||
options = {
|
||||
reduce_vars: true,
|
||||
toplevel: true,
|
||||
unused: true,
|
||||
}
|
||||
mangle = {
|
||||
toplevel: true,
|
||||
}
|
||||
input: {
|
||||
async function await() {
|
||||
console.log("PASS");
|
||||
}
|
||||
await();
|
||||
}
|
||||
expect: {
|
||||
(async function() {
|
||||
console.log("PASS");
|
||||
})();
|
||||
}
|
||||
expect_stdout: "PASS"
|
||||
node_version: ">=8"
|
||||
}
|
||||
|
||||
keep_fname: {
|
||||
options = {
|
||||
keep_fnames: true,
|
||||
reduce_vars: true,
|
||||
toplevel: true,
|
||||
unused: true,
|
||||
}
|
||||
input: {
|
||||
async function await() {
|
||||
console.log("PASS");
|
||||
}
|
||||
await();
|
||||
}
|
||||
expect: {
|
||||
async function await() {
|
||||
console.log("PASS");
|
||||
}
|
||||
await();
|
||||
}
|
||||
expect_stdout: "PASS"
|
||||
node_version: ">=8"
|
||||
}
|
||||
|
||||
nested_await: {
|
||||
input: {
|
||||
(async function() {
|
||||
|
||||
@@ -658,6 +658,30 @@ legacy_scope: {
|
||||
expect_stdout: true
|
||||
}
|
||||
|
||||
hoist_vars: {
|
||||
options = {
|
||||
hoist_vars: true,
|
||||
}
|
||||
input: {
|
||||
{
|
||||
const a = "FAIL";
|
||||
var b = 42;
|
||||
}
|
||||
var a = "PASS";
|
||||
console.log(a, b);
|
||||
}
|
||||
expect: {
|
||||
var b;
|
||||
{
|
||||
const a = "FAIL";
|
||||
b = 42;
|
||||
}
|
||||
var a = "PASS";
|
||||
console.log(a, b);
|
||||
}
|
||||
expect_stdout: true
|
||||
}
|
||||
|
||||
issue_4191: {
|
||||
options = {
|
||||
functions: true,
|
||||
|
||||
@@ -505,6 +505,24 @@ drop_fargs: {
|
||||
node_version: ">=6"
|
||||
}
|
||||
|
||||
hoist_vars: {
|
||||
options = {
|
||||
hoist_vars: true,
|
||||
}
|
||||
input: {
|
||||
var a = "PASS";
|
||||
var [ b = 42 ] = [];
|
||||
console.log(a, b);
|
||||
}
|
||||
expect: {
|
||||
var a = "PASS";
|
||||
var [ b = 42 ] = [];
|
||||
console.log(a, b);
|
||||
}
|
||||
expect_stdout: "PASS 42"
|
||||
node_version: ">=6"
|
||||
}
|
||||
|
||||
unused_var_1: {
|
||||
options = {
|
||||
toplevel: true,
|
||||
|
||||
@@ -1358,6 +1358,24 @@ fn_name_unused: {
|
||||
node_version: ">=6"
|
||||
}
|
||||
|
||||
hoist_vars: {
|
||||
options = {
|
||||
hoist_vars: true,
|
||||
}
|
||||
input: {
|
||||
var a = "PASS";
|
||||
var [ b ] = [ 42 ];
|
||||
console.log(a, b);
|
||||
}
|
||||
expect: {
|
||||
var a = "PASS";
|
||||
var [ b ] = [ 42 ];
|
||||
console.log(a, b);
|
||||
}
|
||||
expect_stdout: "PASS 42"
|
||||
node_version: ">=6"
|
||||
}
|
||||
|
||||
issue_4280: {
|
||||
options = {
|
||||
evaluate: true,
|
||||
|
||||
@@ -89,6 +89,31 @@ sequences_funs: {
|
||||
}
|
||||
}
|
||||
|
||||
catch_var: {
|
||||
options = {
|
||||
dead_code: true,
|
||||
hoist_vars: true,
|
||||
side_effects: true,
|
||||
toplevel: true,
|
||||
unused: true,
|
||||
}
|
||||
input: {
|
||||
var a = "PASS";
|
||||
try {
|
||||
a;
|
||||
} catch (a) {
|
||||
var a = 0;
|
||||
a;
|
||||
}
|
||||
console.log(a);
|
||||
}
|
||||
expect: {
|
||||
var a = "PASS";
|
||||
console.log(a);
|
||||
}
|
||||
expect_stdout: "PASS"
|
||||
}
|
||||
|
||||
issue_2295: {
|
||||
options = {
|
||||
collapse_vars: true,
|
||||
|
||||
@@ -21,9 +21,12 @@
|
||||
},
|
||||
{
|
||||
"compress": {
|
||||
"hoist_vars": true,
|
||||
"keep_infinity": true,
|
||||
"passes": 1e6,
|
||||
"unsafe": true
|
||||
},
|
||||
"keep_fnames": true,
|
||||
"toplevel": true
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user