mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
test: add tests for boolean related comparison (#563)
This commit is contained in:
parent
d410d1a2d7
commit
3cbec3459a
1 changed files with 39 additions and 0 deletions
|
|
@ -232,6 +232,45 @@ fn test_null_comparison1() {
|
|||
test_same("x==null");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_boolean_boolean_comparison() {
|
||||
test_same("!x==!y");
|
||||
test_same("!x<!y");
|
||||
test_same("!x!==!y");
|
||||
|
||||
test_same("!x==!x"); // foldable
|
||||
test_same("!x<!x"); // foldable
|
||||
test_same("!x!==!x"); // foldable
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_boolean_number_comparison() {
|
||||
test_same("!x==+y");
|
||||
test_same("!x<=+y");
|
||||
test_wcb("!x !== +y", "true");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_number_boolean_comparison() {
|
||||
test_same("+x==!y");
|
||||
test_same("+x<=!y");
|
||||
test_wcb("+x === !y", "false");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_boolean_string_comparison() {
|
||||
test_same("!x==''+y");
|
||||
test_same("!x<=''+y");
|
||||
test_wcb("!x !== '' + y", "true");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_string_boolean_comparison() {
|
||||
test_same("''+x==!y");
|
||||
test_same("''+x<=!y");
|
||||
test_wcb("'' + x === !y", "false");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_string_string_comparison() {
|
||||
test("'a' < 'b'", "!0");
|
||||
|
|
|
|||
Loading…
Reference in a new issue