Skip to content

Commit

Permalink
chore(minifier): align test name with closure-compiler (#6359)
Browse files Browse the repository at this point in the history
Keep consistency in test naming.
  • Loading branch information
shulaoda authored Oct 8, 2024
1 parent 3b53dd4 commit 87f700f
Showing 1 changed file with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ mod test {
}

#[test]
fn fold_return_result() {
fn test_fold_return_result() {
test("function f(){return !1;}", "function f(){return !1}");
test("function f(){return null;}", "function f(){return null}");
test("function f(){return void 0;}", "function f(){return}");
Expand All @@ -515,21 +515,21 @@ mod test {
}

#[test]
fn undefined() {
fn test_undefined() {
test("var x = undefined", "var x");
test_same("var undefined = 1;function f() {var undefined=2;var x;}");
test("function f(undefined) {}", "function f(undefined){}");
test("try {} catch(undefined) {}", "try{}catch(undefined){}");
test("for (undefined in {}) {}", "for(undefined in {}){}");
test("undefined++", "undefined++");
test("undefined += undefined", "undefined+=void 0");
test("undefined++;", "undefined++");
test("undefined += undefined;", "undefined+=void 0");

// shadowd
test_same("(function(undefined) { let x = typeof undefined; })()");
}

#[test]
fn fold_true_false_comparison() {
fn test_fold_true_false_comparison() {
test("x == true", "x == 1");
test("x == false", "x == 0");
test("x != true", "x != 1");
Expand Down Expand Up @@ -561,17 +561,16 @@ mod test {
}

#[test]
fn fold_literal_object_constructors() {
fn test_fold_literal_object_constructors() {
test("x = new Object", "x = ({})");
test("x = new Object()", "x = ({})");
test("x = Object()", "x = ({})");

test_same("x = (function f(){function Object(){this.x=4}return new Object();})();");
}

// tests from closure compiler
#[test]
fn fold_literal_array_constructors() {
fn test_fold_literal_array_constructors() {
test("x = new Array", "x = []");
test("x = new Array()", "x = []");
test("x = Array()", "x = []");
Expand Down

0 comments on commit 87f700f

Please sign in to comment.