diff --git a/crates/oxc_minifier/src/peephole/minimize_conditions.rs b/crates/oxc_minifier/src/peephole/minimize_conditions.rs index d500aa0e23f87..508a1a35926b7 100644 --- a/crates/oxc_minifier/src/peephole/minimize_conditions.rs +++ b/crates/oxc_minifier/src/peephole/minimize_conditions.rs @@ -1468,29 +1468,28 @@ mod test { } #[test] - #[ignore] fn test_fold_logical_op_string_compare() { // side-effects // There is two way to parse two &&'s and both are correct. - test("if (foo() && false) z()", "(foo(), 0) && z()"); + test("if (foo() && false) z()", "foo() && !1"); } #[test] - #[ignore] fn test_fold_not() { - test("while(!(x==y)){a=b;}", "while(x!=y){a=b;}"); - test("while(!(x!=y)){a=b;}", "while(x==y){a=b;}"); - test("while(!(x===y)){a=b;}", "while(x!==y){a=b;}"); - test("while(!(x!==y)){a=b;}", "while(x===y){a=b;}"); + test("for(; !(x==y) ;) a=b", "for(; x!=y ;) a=b"); + test("for(; !(x!=y) ;) a=b", "for(; x==y ;) a=b"); + test("for(; !(x===y) ;) a=b", "for(; x!==y ;) a=b"); + test("for(; !(x!==y) ;) a=b", "for(; x===y ;) a=b"); // Because !(x=NaN don't fold < and > cases. - test_same("while(!(x>y)){a=b;}"); - test_same("while(!(x>=y)){a=b;}"); - test_same("while(!(xy) ;) a=b"); + test_same("for(; !(x>=y) ;) a=b"); + test_same("for(; !(x