1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-02 23:32:06 +00:00

LibJS/Tests: Set failing bytecode tests as xfail when in bytecode mode

This should allow us to enable running test-js in bytecode mode in CI.
This commit is contained in:
Shannon Booth 2023-07-22 17:30:15 +12:00 committed by Andreas Kling
parent 9b66e87bd8
commit d766014787
17 changed files with 145 additions and 110 deletions

View file

@ -1,5 +1,5 @@
describe("basic usage", () => {
test("disposes after block exit", () => {
test.xfailIf(isBytecodeInterpreterEnabled(), "disposes after block exit", () => {
let disposed = false;
let inBlock = false;
{
@ -13,7 +13,7 @@ describe("basic usage", () => {
expect(disposed).toBeTrue();
});
test("disposes in reverse order after block exit", () => {
test.xfailIf(isBytecodeInterpreterEnabled(), "disposes in reverse order after block exit", () => {
const disposed = [];
{
expect(disposed).toHaveLength(0);
@ -25,7 +25,7 @@ describe("basic usage", () => {
expect(disposed).toEqual(['b', 'a']);
});
test("disposes in reverse order after block exit even in same declaration", () => {
test.xfailIf(isBytecodeInterpreterEnabled(), "disposes in reverse order after block exit even in same declaration", () => {
const disposed = [];
{
expect(disposed).toHaveLength(0);
@ -41,7 +41,7 @@ describe("basic usage", () => {
describe("behavior with exceptions", () => {
function ExpectedError(name) { this.name = name; }
test("is run even after throw", () => {
test.xfailIf(isBytecodeInterpreterEnabled(), "is run even after throw", () => {
let disposed = false;
let inBlock = false;
let inCatch = false;
@ -62,7 +62,7 @@ describe("behavior with exceptions", () => {
expect(inCatch).toBeTrue();
});
test("throws error if dispose method does", () => {
test.xfailIf(isBytecodeInterpreterEnabled(), "throws error if dispose method does", () => {
let disposed = false;
let endOfTry = false;
let inCatch = false;
@ -84,7 +84,7 @@ describe("behavior with exceptions", () => {
expect(inCatch).toBeTrue();
});
test("if block and using throw get suppressed error", () => {
test.xfailIf(isBytecodeInterpreterEnabled(), "if block and using throw get suppressed error", () => {
let disposed = false;
let inCatch = false;
try {
@ -108,7 +108,7 @@ describe("behavior with exceptions", () => {
expect(inCatch).toBeTrue();
});
test("multiple throwing disposes give suppressed error", () => {
test.xfailIf(isBytecodeInterpreterEnabled(), "multiple throwing disposes give suppressed error", () => {
let inCatch = false;
try {
{
@ -133,7 +133,7 @@ describe("behavior with exceptions", () => {
expect(inCatch).toBeTrue();
});
test("3 throwing disposes give chaining suppressed error", () => {
test.xfailIf(isBytecodeInterpreterEnabled(), "3 throwing disposes give chaining suppressed error", () => {
let inCatch = false;
try {
{
@ -168,7 +168,7 @@ describe("behavior with exceptions", () => {
expect(inCatch).toBeTrue();
});
test("normal error and multiple disposing erorrs give chaining suppressed errors", () => {
test.xfailIf(isBytecodeInterpreterEnabled(), "normal error and multiple disposing erorrs give chaining suppressed errors", () => {
let inCatch = false;
try {
using a = { [Symbol.dispose]() {
@ -199,7 +199,7 @@ describe("behavior with exceptions", () => {
});
describe("works in a bunch of scopes", () => {
test("works in block", () => {
test.xfailIf(isBytecodeInterpreterEnabled(), "works in block", () => {
let dispose = false;
expect(dispose).toBeFalse();
{
@ -210,7 +210,7 @@ describe("works in a bunch of scopes", () => {
expect(dispose).toBeTrue();
});
test("works in static class block", () => {
test.xfailIf(isBytecodeInterpreterEnabled(), "works in static class block", () => {
let dispose = false;
expect(dispose).toBeFalse();
class A {
@ -223,7 +223,7 @@ describe("works in a bunch of scopes", () => {
expect(dispose).toBeTrue();
});
test("works in function", () => {
test.xfailIf(isBytecodeInterpreterEnabled(), "works in function", () => {
let dispose = [];
function f(val) {
const disposeLength = dispose.length;
@ -237,7 +237,7 @@ describe("works in a bunch of scopes", () => {
expect(dispose).toEqual([0, 1]);
});
test("switch block is treated as full block in function", () => {
test.xfailIf(isBytecodeInterpreterEnabled(), "switch block is treated as full block in function", () => {
let disposeFull = [];
let disposeInner = false;
@ -284,13 +284,13 @@ describe("works in a bunch of scopes", () => {
});
describe("invalid using bindings", () => {
test("nullish values do not throw", () => {
test.xfailIf(isBytecodeInterpreterEnabled(), "nullish values do not throw", () => {
using a = null, b = undefined;
expect(a).toBeNull();
expect(b).toBeUndefined();
});
test("non-object throws", () => {
test.xfailIf(isBytecodeInterpreterEnabled(), "non-object throws", () => {
[0, "a", true, NaN, 4n, Symbol.dispose].forEach(value => {
expect(() => {
using v = value;
@ -298,13 +298,13 @@ describe("invalid using bindings", () => {
});
});
test("object without dispose throws", () => {
test.xfailIf(isBytecodeInterpreterEnabled(), "object without dispose throws", () => {
expect(() => {
using a = {};
}).toThrowWithMessage(TypeError, "does not have dispose method");
});
test("object with non callable dispose throws", () => {
test.xfailIf(isBytecodeInterpreterEnabled(), "object with non callable dispose throws", () => {
[0, "a", true, NaN, 4n, Symbol.dispose, [], {}].forEach(value => {
expect(() => {
using a = { [Symbol.dispose]: value };
@ -332,7 +332,7 @@ describe("using is still a valid variable name", () => {
expect(using).toBe(1);
});
test("using", () => {
test.xfailIf(isBytecodeInterpreterEnabled(), "using", () => {
"use strict";
using using = null;
expect(using).toBeNull();