test(minifier): add tests for bigint string comparison (#541)

This commit is contained in:
阿良仔 2023-07-13 11:44:03 +08:00 committed by GitHub
parent ea85ee9f2d
commit db3ef449fc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -229,6 +229,30 @@ fn test_bigint_number_comparison() {
test_wcb("1n > null", "true");
}
#[test]
fn test_bigint_string_comparison() {
test_wcb("1n < '2'", "true");
test_wcb("2n > '1'", "true");
test_wcb("123n > '34'", "true");
test_wcb("1n == '1'", "true");
test_wcb("1n == '2'", "false");
test_wcb("1n != '1'", "false");
test_wcb("1n === '1'", "false");
test_wcb("1n !== '1'", "true");
}
#[test]
fn test_string_bigint_comparison() {
test_wcb("'1' < 2n", "true");
test_wcb("'2' > 1n", "true");
test_wcb("'123' > 34n", "true");
test_wcb("'1' == 1n", "true");
test_wcb("'1' == 2n", "false");
test_wcb("'1' != 1n", "false");
test_wcb("'1' === 1n", "false");
test_wcb("'1' !== 1n", "true");
}
#[test]
fn js_typeof() {
test("x = typeof 1", "x='number'");