1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:38:12 +00:00

LibJS: Remove bytecode condition from tests expected to fail

This commit is contained in:
Timothy Flynn 2023-08-09 15:14:05 -04:00 committed by Luke Wilde
parent 854330ec73
commit 375a6f5dd9
17 changed files with 143 additions and 186 deletions

View file

@ -130,37 +130,26 @@ describe("special left hand sides", () => {
expect(f().a).toBe("c");
});
test.xfailIf(
isBytecodeInterpreterEnabled(),
"call function is allowed in parsing but fails in runtime",
() => {
function f() {
expect().fail();
}
// Does not fail since it does not iterate but prettier does not like it so we use eval.
expect("for (f() of []);").toEvalTo(undefined);
expect(() => {
eval("for (f() of [0]) { expect().fail() }");
}).toThrowWithMessage(ReferenceError, "Invalid left-hand side in assignment");
test.xfail("call function is allowed in parsing but fails in runtime", () => {
function f() {
expect().fail();
}
);
test.xfailIf(
isBytecodeInterpreterEnabled(),
"Cannot change constant declaration in body",
() => {
const vals = [];
for (const v of [1, 2]) {
expect(() => v++).toThrowWithMessage(
TypeError,
"Invalid assignment to const variable"
);
vals.push(v);
}
// Does not fail since it does not iterate but prettier does not like it so we use eval.
expect("for (f() of []);").toEvalTo(undefined);
expect(vals).toEqual([1, 2]);
expect(() => {
eval("for (f() of [0]) { expect().fail() }");
}).toThrowWithMessage(ReferenceError, "Invalid left-hand side in assignment");
});
test.xfail("Cannot change constant declaration in body", () => {
const vals = [];
for (const v of [1, 2]) {
expect(() => v++).toThrowWithMessage(TypeError, "Invalid assignment to const variable");
vals.push(v);
}
);
expect(vals).toEqual([1, 2]);
});
});