Skip to content

Commit

Permalink
test: port test262 suite.
Browse files Browse the repository at this point in the history
  • Loading branch information
7086cmd authored and Boshen committed Oct 3, 2024
1 parent 8086d27 commit c5abeb2
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion crates/oxc_minifier/src/ast_passes/peephole_fold_constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1551,12 +1551,25 @@ mod test {
test("x = -1 >>> 0", "x=4294967295"); // 0xffffffff
test("x = -2 >>> 0", "x=4294967294"); // 0xfffffffe
test("x = 0x90000000 >>> 28", "x=9");
test("x = -2147483649 >>> 0", "x=2147483647");

test("x = 0xffffffff << 0", "x=-1");
test("x = 0xffffffff << 4", "x=-16");
test("1 << 32", "1<<32");
test("1 << -1", "1<<-1");
test("1 >> 32", "1>>32");

// Regression on #6161, ported from <https://github.com/tc39/test262/blob/main/test/language/expressions/unsigned-right-shift/S9.6_A2.2.js>.
test("-2147483647 >>> 0", "2147483649");
test("-2147483648 >>> 0", "2147483648");
test("-2147483649 >>> 0", "2147483647");
test("-4294967295 >>> 0", "1");
test("-4294967296 >>> 0", "0");
test("-4294967297 >>> 0", "4294967295");
test("4294967295 >>> 0", "4294967295");
test("4294967296 >>> 0", "0");
test("4294967297 >>> 0", "1");
test("8589934591 >>> 0", "4294967295");
test("8589934592 >>> 0", "0");
test("8589934593 >>> 0", "1");
}
}

0 comments on commit c5abeb2

Please sign in to comment.