test(minifier): add anonymous function test case for logical expression to logical assignment compression (#8347)

Added a test case that tells having an anonymous function on the right hand side for "logical expression to logical assignment" compression is fine.
This commit is contained in:
sapphi-red 2025-01-08 13:22:49 +00:00
parent 9a5c66ac6a
commit 3149fe0aa4
No known key found for this signature in database
GPG key ID: 67631A259A77AC6C

View file

@ -1520,6 +1520,10 @@ mod test {
test("x && (x = g())", "x &&= g()");
test("x ?? (x = g())", "x ??= g()");
// `||=`, `&&=`, `??=` sets the name property of the function
// Example case: `let f = false; f || (f = () => {}); console.log(f.name)`
test("x || (x = () => 'a')", "x ||= () => 'a'");
test_same("x || (y = 3)");
// foo() might have a side effect