Skip to content

Commit

Permalink
chore: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sapphi-red committed Dec 28, 2024
1 parent f2b1ce1 commit bb047ee
Showing 1 changed file with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1164,29 +1164,29 @@ mod test {

#[test]
fn test_fold_is_typeof_equals_undefined_resolved() {
test("var x; typeof x !== 'undefined'", "var x; x !== undefined");
test("var x; typeof x != 'undefined'", "var x; x !== undefined");
test("var x; 'undefined' !== typeof x", "var x; x !== undefined");
test("var x; 'undefined' != typeof x", "var x; x !== undefined");
test("var x; typeof x !== 'undefined'", "var x; x !== void 0");
test("var x; typeof x != 'undefined'", "var x; x !== void 0");
test("var x; 'undefined' !== typeof x", "var x; x !== void 0");
test("var x; 'undefined' != typeof x", "var x; x !== void 0");

test("var x; typeof x === 'undefined'", "var x; x === undefined");
test("var x; typeof x == 'undefined'", "var x; x === undefined");
test("var x; 'undefined' === typeof x", "var x; x === undefined");
test("var x; 'undefined' == typeof x", "var x; x === undefined");
test("var x; typeof x === 'undefined'", "var x; x === void 0");
test("var x; typeof x == 'undefined'", "var x; x === void 0");
test("var x; 'undefined' === typeof x", "var x; x === void 0");
test("var x; 'undefined' == typeof x", "var x; x === void 0");

test(
"var x; function foo() { typeof x !== 'undefined' }",
"var x; function foo() { x !== undefined }",
"var x; function foo() { x !== void 0 }",
);
test(
"typeof x !== 'undefined'; function foo() { var x }",
"typeof x < 'u'; function foo() { var x }",
);
test("typeof x !== 'undefined'; { var x }", "x !== undefined; { var x }");
test("typeof x !== 'undefined'; { var x }", "x !== void 0; { var x }");
test("typeof x !== 'undefined'; { let x }", "typeof x < 'u'; { let x }");
test("typeof x !== 'undefined'; var x", "x !== undefined; var x");
test("typeof x !== 'undefined'; var x", "x !== void 0; var x");
// input and output both errors with same TDZ error
test("typeof x !== 'undefined'; let x", "x !== undefined; let x");
test("typeof x !== 'undefined'; let x", "x !== void 0; let x");
}

/// Port from <https://github.com/evanw/esbuild/blob/v0.24.2/internal/js_parser/js_parser_test.go#L4658>
Expand Down

0 comments on commit bb047ee

Please sign in to comment.