From 375a6f5dd98bf72de6f306c8e75257e3e412408c Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Wed, 9 Aug 2023 15:14:05 -0400 Subject: [PATCH] LibJS: Remove bytecode condition from tests expected to fail --- .../DisposableStack.prototype.@@dispose.js | 2 +- .../builtins/Error/Error.prototype.stack.js | 2 +- ...alizationRegistry.prototype.cleanupSome.js | 2 +- .../ShadowRealm.prototype.importValue.js | 2 +- .../builtins/WeakMap/WeakMap.prototype.set.js | 34 ++++---- .../builtins/WeakSet/WeakSet.prototype.add.js | 34 ++++---- .../LibJS/Tests/invalid-lhs-in-assignment.js | 4 +- .../LibJS/Tests/loops/for-in-basic.js | 47 ++++------ .../LibJS/Tests/loops/for-of-basic.js | 47 ++++------ .../LibJS/Tests/modules/basic-modules.js | 3 +- .../Libraries/LibJS/Tests/object-basic.js | 4 +- .../Libraries/LibJS/Tests/object-spread.js | 2 +- .../LibJS/Tests/strict-mode-errors.js | 2 +- .../LibJS/Tests/syntax/async-await.js | 86 ++++++++----------- .../LibJS/Tests/tagged-template-literals.js | 4 +- .../LibJS/Tests/using-declaration.js | 36 ++++---- .../Libraries/LibJS/Tests/using-for-loops.js | 18 ++-- 17 files changed, 143 insertions(+), 186 deletions(-) diff --git a/Userland/Libraries/LibJS/Tests/builtins/DisposableStack/DisposableStack.prototype.@@dispose.js b/Userland/Libraries/LibJS/Tests/builtins/DisposableStack/DisposableStack.prototype.@@dispose.js index 61fb7d2ea6..1199c8c0d9 100644 --- a/Userland/Libraries/LibJS/Tests/builtins/DisposableStack/DisposableStack.prototype.@@dispose.js +++ b/Userland/Libraries/LibJS/Tests/builtins/DisposableStack/DisposableStack.prototype.@@dispose.js @@ -7,7 +7,7 @@ test("is the same as dispose", () => { }); describe("used in using functionality", () => { - test.xfailIf(isBytecodeInterpreterEnabled(), "make the stack marked as disposed", () => { + test.xfail("make the stack marked as disposed", () => { let innerStack; { using stack = new DisposableStack(); diff --git a/Userland/Libraries/LibJS/Tests/builtins/Error/Error.prototype.stack.js b/Userland/Libraries/LibJS/Tests/builtins/Error/Error.prototype.stack.js index 95f0ae03e3..30a2e95ae0 100644 --- a/Userland/Libraries/LibJS/Tests/builtins/Error/Error.prototype.stack.js +++ b/Userland/Libraries/LibJS/Tests/builtins/Error/Error.prototype.stack.js @@ -3,7 +3,7 @@ const stackGetter = stackDescriptor.get; const stackSetter = stackDescriptor.set; describe("getter - normal behavior", () => { - test.xfailIf(isBytecodeInterpreterEnabled(), "basic functionality", () => { + test.xfail("basic functionality", () => { const stackFrames = [ /^ at .*Error \(.*\/Error\.prototype\.stack\.js:\d+:\d+\)$/, /^ at .+\/Error\/Error\.prototype\.stack\.js:\d+:\d+$/, diff --git a/Userland/Libraries/LibJS/Tests/builtins/FinalizationRegistry/FinalizationRegistry.prototype.cleanupSome.js b/Userland/Libraries/LibJS/Tests/builtins/FinalizationRegistry/FinalizationRegistry.prototype.cleanupSome.js index 326cf3f510..d5307dc362 100644 --- a/Userland/Libraries/LibJS/Tests/builtins/FinalizationRegistry/FinalizationRegistry.prototype.cleanupSome.js +++ b/Userland/Libraries/LibJS/Tests/builtins/FinalizationRegistry/FinalizationRegistry.prototype.cleanupSome.js @@ -8,7 +8,7 @@ function registerInDifferentScope(registry) { return target; } -test.xfailIf(isBytecodeInterpreterEnabled(), "basic functionality", () => { +test.xfail("basic functionality", () => { var registry = new FinalizationRegistry(() => {}); var count = 0; diff --git a/Userland/Libraries/LibJS/Tests/builtins/ShadowRealm/ShadowRealm.prototype.importValue.js b/Userland/Libraries/LibJS/Tests/builtins/ShadowRealm/ShadowRealm.prototype.importValue.js index 4c7322f4c8..74ea9b115b 100644 --- a/Userland/Libraries/LibJS/Tests/builtins/ShadowRealm/ShadowRealm.prototype.importValue.js +++ b/Userland/Libraries/LibJS/Tests/builtins/ShadowRealm/ShadowRealm.prototype.importValue.js @@ -40,7 +40,7 @@ describe("normal behavior", () => { expect(passed).toBeTrue(); }); - test.xfailIf(isBytecodeInterpreterEnabled(), "value from async module", () => { + test.xfail("value from async module", () => { const shadowRealm = new ShadowRealm(); const promise = shadowRealm.importValue("./async-module.mjs", "foo"); expect(promise).toBeInstanceOf(Promise); diff --git a/Userland/Libraries/LibJS/Tests/builtins/WeakMap/WeakMap.prototype.set.js b/Userland/Libraries/LibJS/Tests/builtins/WeakMap/WeakMap.prototype.set.js index 7b836c4964..dfb73702d7 100644 --- a/Userland/Libraries/LibJS/Tests/builtins/WeakMap/WeakMap.prototype.set.js +++ b/Userland/Libraries/LibJS/Tests/builtins/WeakMap/WeakMap.prototype.set.js @@ -21,29 +21,25 @@ test("invalid values", () => { }); }); -test.xfailIf( - isBytecodeInterpreterEnabled(), - "automatic removal of garbage-collected values", - () => { - const weakMap = new WeakMap(); - const objectKey = { e: 3 }; +test.xfail("automatic removal of garbage-collected values", () => { + const weakMap = new WeakMap(); + const objectKey = { e: 3 }; - expect(weakMap.set(objectKey, 1)).toBe(weakMap); - expect(getWeakMapSize(weakMap)).toBe(1); + expect(weakMap.set(objectKey, 1)).toBe(weakMap); + expect(getWeakMapSize(weakMap)).toBe(1); - markAsGarbage("objectKey"); - gc(); + markAsGarbage("objectKey"); + gc(); - expect(getWeakMapSize(weakMap)).toBe(0); + expect(getWeakMapSize(weakMap)).toBe(0); - const symbolKey = Symbol("foo"); + const symbolKey = Symbol("foo"); - expect(weakMap.set(symbolKey, "bar")).toBe(weakMap); - expect(getWeakMapSize(weakMap)).toBe(1); + expect(weakMap.set(symbolKey, "bar")).toBe(weakMap); + expect(getWeakMapSize(weakMap)).toBe(1); - markAsGarbage("symbolKey"); - gc(); + markAsGarbage("symbolKey"); + gc(); - expect(getWeakMapSize(weakMap)).toBe(0); - } -); + expect(getWeakMapSize(weakMap)).toBe(0); +}); diff --git a/Userland/Libraries/LibJS/Tests/builtins/WeakSet/WeakSet.prototype.add.js b/Userland/Libraries/LibJS/Tests/builtins/WeakSet/WeakSet.prototype.add.js index 70ee5fb210..e5ceda3feb 100644 --- a/Userland/Libraries/LibJS/Tests/builtins/WeakSet/WeakSet.prototype.add.js +++ b/Userland/Libraries/LibJS/Tests/builtins/WeakSet/WeakSet.prototype.add.js @@ -16,29 +16,25 @@ test("invalid values", () => { }); }); -test.xfailIf( - isBytecodeInterpreterEnabled(), - "automatic removal of garbage-collected values", - () => { - const weakSet = new WeakSet(); - const objectItem = { a: 1 }; +test.xfail("automatic removal of garbage-collected values", () => { + const weakSet = new WeakSet(); + const objectItem = { a: 1 }; - expect(weakSet.add(objectItem)).toBe(weakSet); - expect(getWeakSetSize(weakSet)).toBe(1); + expect(weakSet.add(objectItem)).toBe(weakSet); + expect(getWeakSetSize(weakSet)).toBe(1); - markAsGarbage("objectItem"); - gc(); + markAsGarbage("objectItem"); + gc(); - expect(getWeakSetSize(weakSet)).toBe(0); + expect(getWeakSetSize(weakSet)).toBe(0); - const symbolItem = Symbol("foo"); + const symbolItem = Symbol("foo"); - expect(weakSet.add(symbolItem)).toBe(weakSet); - expect(getWeakSetSize(weakSet)).toBe(1); + expect(weakSet.add(symbolItem)).toBe(weakSet); + expect(getWeakSetSize(weakSet)).toBe(1); - markAsGarbage("symbolItem"); - gc(); + markAsGarbage("symbolItem"); + gc(); - expect(getWeakSetSize(weakSet)).toBe(0); - } -); + expect(getWeakSetSize(weakSet)).toBe(0); +}); diff --git a/Userland/Libraries/LibJS/Tests/invalid-lhs-in-assignment.js b/Userland/Libraries/LibJS/Tests/invalid-lhs-in-assignment.js index 4393eb97fd..ad329dc826 100644 --- a/Userland/Libraries/LibJS/Tests/invalid-lhs-in-assignment.js +++ b/Userland/Libraries/LibJS/Tests/invalid-lhs-in-assignment.js @@ -1,4 +1,4 @@ -test.xfailIf(isBytecodeInterpreterEnabled(), "assignment to function call", () => { +test.xfail("assignment to function call", () => { expect(() => { function foo() {} foo() = "foo"; @@ -9,7 +9,7 @@ test("assignment to function call in strict mode", () => { expect("'use strict'; foo() = 'foo'").toEval(); }); -test.xfailIf(isBytecodeInterpreterEnabled(), "assignment to inline function call", () => { +test.xfail("assignment to inline function call", () => { expect(() => { (function () {})() = "foo"; }).toThrowWithMessage(ReferenceError, "Invalid left-hand side in assignment"); diff --git a/Userland/Libraries/LibJS/Tests/loops/for-in-basic.js b/Userland/Libraries/LibJS/Tests/loops/for-in-basic.js index d002f46e20..5fd98f12cb 100644 --- a/Userland/Libraries/LibJS/Tests/loops/for-in-basic.js +++ b/Userland/Libraries/LibJS/Tests/loops/for-in-basic.js @@ -86,39 +86,28 @@ describe("special left hand sides", () => { expect(b.a).toBe("2"); }); - 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 - expect("for (f() in []);").toEvalTo(undefined); - - expect(() => { - eval("for (f() in [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 in [1, 2]) { - expect(() => v++).toThrowWithMessage( - TypeError, - "Invalid assignment to const variable" - ); - vals.push(v); - } + // Does not fail since it does not iterate + expect("for (f() in []);").toEvalTo(undefined); - expect(vals).toEqual(["0", "1"]); + expect(() => { + eval("for (f() in [0]) { expect().fail() }"); + }).toThrowWithMessage(ReferenceError, "Invalid left-hand side in assignment"); + }); + + test.xfail("Cannot change constant declaration in body", () => { + const vals = []; + for (const v in [1, 2]) { + expect(() => v++).toThrowWithMessage(TypeError, "Invalid assignment to const variable"); + vals.push(v); } - ); + + expect(vals).toEqual(["0", "1"]); + }); }); test("remove properties while iterating", () => { diff --git a/Userland/Libraries/LibJS/Tests/loops/for-of-basic.js b/Userland/Libraries/LibJS/Tests/loops/for-of-basic.js index acb78cbade..29707bf04d 100644 --- a/Userland/Libraries/LibJS/Tests/loops/for-of-basic.js +++ b/Userland/Libraries/LibJS/Tests/loops/for-of-basic.js @@ -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]); + }); }); diff --git a/Userland/Libraries/LibJS/Tests/modules/basic-modules.js b/Userland/Libraries/LibJS/Tests/modules/basic-modules.js index 109af6f109..23b61dbdad 100644 --- a/Userland/Libraries/LibJS/Tests/modules/basic-modules.js +++ b/Userland/Libraries/LibJS/Tests/modules/basic-modules.js @@ -207,8 +207,7 @@ describe("in- and exports", () => { expectModulePassed("./anon-func-decl-default-export.mjs"); }); - test.xfailIf( - isBytecodeInterpreterEnabled(), + test.xfail( "can have top level using declarations which trigger at the end of running a module", () => { expectModulePassed("./top-level-dispose.mjs"); diff --git a/Userland/Libraries/LibJS/Tests/object-basic.js b/Userland/Libraries/LibJS/Tests/object-basic.js index 65bc88280f..f04b87ffcf 100644 --- a/Userland/Libraries/LibJS/Tests/object-basic.js +++ b/Userland/Libraries/LibJS/Tests/object-basic.js @@ -221,13 +221,13 @@ describe("naming of anon functions", () => { expect({ func() {} }.func.name).toBe("func"); }); - test.xfailIf(isBytecodeInterpreterEnabled(), "getter has name", () => { + test.xfail("getter has name", () => { expect(Object.getOwnPropertyDescriptor({ get func() {} }, "func").get.name).toBe( "get func" ); }); - test.xfailIf(isBytecodeInterpreterEnabled(), "setter has name", () => { + test.xfail("setter has name", () => { expect(Object.getOwnPropertyDescriptor({ set func(v) {} }, "func").set.name).toBe( "set func" ); diff --git a/Userland/Libraries/LibJS/Tests/object-spread.js b/Userland/Libraries/LibJS/Tests/object-spread.js index 7a93f5283e..340e04746a 100644 --- a/Userland/Libraries/LibJS/Tests/object-spread.js +++ b/Userland/Libraries/LibJS/Tests/object-spread.js @@ -144,7 +144,7 @@ describe("modification of spreadable objects during spread", () => { expect(Object.getOwnPropertyNames(result)).toContain("bar"); }); - test.xfailIf(isBytecodeInterpreterEnabled(), "spreading array", () => { + test.xfail("spreading array", () => { const array = [0]; array[2] = 2; array[999] = 999; diff --git a/Userland/Libraries/LibJS/Tests/strict-mode-errors.js b/Userland/Libraries/LibJS/Tests/strict-mode-errors.js index 46825d5a28..26bb39dd4a 100644 --- a/Userland/Libraries/LibJS/Tests/strict-mode-errors.js +++ b/Userland/Libraries/LibJS/Tests/strict-mode-errors.js @@ -1,6 +1,6 @@ "use strict"; -test.xfailIf(isBytecodeInterpreterEnabled(), "basic functionality", () => { +test.xfail("basic functionality", () => { [true, false, "foo", 123].forEach(primitive => { expect(() => { primitive.foo = "bar"; diff --git a/Userland/Libraries/LibJS/Tests/syntax/async-await.js b/Userland/Libraries/LibJS/Tests/syntax/async-await.js index 47e0aea3d7..b95f67fad6 100644 --- a/Userland/Libraries/LibJS/Tests/syntax/async-await.js +++ b/Userland/Libraries/LibJS/Tests/syntax/async-await.js @@ -64,7 +64,7 @@ test("async function cannot use await in default parameters", () => { // Even as a reference to some variable it is not allowed expect(` var await = 4; - async function foo(x = await) {} + async function foo(x = await) {} `).not.toEval(); }); @@ -216,55 +216,43 @@ describe("await thenables", () => { expect(isCalled).toBe(true); }); - test.xfailIf( - isBytecodeInterpreterEnabled(), - "async returning a thanable variable that fulfills", - () => { - let isCalled = false; - const obj = { - then(fulfill) { - isCalled = true; - fulfill(isCalled); - }, - }; + test.xfail("async returning a thanable variable that fulfills", () => { + let isCalled = false; + const obj = { + then(fulfill) { + isCalled = true; + fulfill(isCalled); + }, + }; - const f = async () => await obj; - f(); - runQueuedPromiseJobs(); - expect(isCalled).toBe(true); - } - ); + const f = async () => await obj; + f(); + runQueuedPromiseJobs(); + expect(isCalled).toBe(true); + }); - test.xfailIf( - isBytecodeInterpreterEnabled(), - "async returning a thenable directly without fulfilling", - () => { - let isCalled = false; - const f = async () => ({ - then() { - isCalled = true; - }, - }); - f(); - runQueuedPromiseJobs(); - expect(isCalled).toBe(true); - } - ); + test.xfail("async returning a thenable directly without fulfilling", () => { + let isCalled = false; + const f = async () => ({ + then() { + isCalled = true; + }, + }); + f(); + runQueuedPromiseJobs(); + expect(isCalled).toBe(true); + }); - test.xfailIf( - isBytecodeInterpreterEnabled(), - "async returning a thenable directly that fulfills", - () => { - let isCalled = false; - const f = async () => ({ - then(fulfill) { - isCalled = true; - fulfill(isCalled); - }, - }); - f(); - runQueuedPromiseJobs(); - expect(isCalled).toBe(true); - } - ); + test.xfail("async returning a thenable directly that fulfills", () => { + let isCalled = false; + const f = async () => ({ + then(fulfill) { + isCalled = true; + fulfill(isCalled); + }, + }); + f(); + runQueuedPromiseJobs(); + expect(isCalled).toBe(true); + }); }); diff --git a/Userland/Libraries/LibJS/Tests/tagged-template-literals.js b/Userland/Libraries/LibJS/Tests/tagged-template-literals.js index 27b3aaeb38..031b585260 100644 --- a/Userland/Libraries/LibJS/Tests/tagged-template-literals.js +++ b/Userland/Libraries/LibJS/Tests/tagged-template-literals.js @@ -154,7 +154,7 @@ describe("tagged template literal functionality", () => { expect(stringsValue.raw[1]).toBe("invalid\\u"); }); - test.xfailIf(isBytecodeInterpreterEnabled(), "string value gets cached per AST node", () => { + test.xfail("string value gets cached per AST node", () => { function call(func, val) { return func`template${val}second`; } @@ -164,7 +164,7 @@ describe("tagged template literal functionality", () => { expect(firstResult).toBe(secondResult); }); - test.xfailIf(isBytecodeInterpreterEnabled(), "this value of call comes from reference", () => { + test.xfail("this value of call comes from reference", () => { let thisValue = null; const obj = { func() { diff --git a/Userland/Libraries/LibJS/Tests/using-declaration.js b/Userland/Libraries/LibJS/Tests/using-declaration.js index dfa9aa05be..f4b1b14e57 100644 --- a/Userland/Libraries/LibJS/Tests/using-declaration.js +++ b/Userland/Libraries/LibJS/Tests/using-declaration.js @@ -1,5 +1,5 @@ describe("basic usage", () => { - test.xfailIf(isBytecodeInterpreterEnabled(), "disposes after block exit", () => { + test.xfail("disposes after block exit", () => { let disposed = false; let inBlock = false; { @@ -13,7 +13,7 @@ describe("basic usage", () => { expect(disposed).toBeTrue(); }); - test.xfailIf(isBytecodeInterpreterEnabled(), "disposes in reverse order after block exit", () => { + test.xfail("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.xfailIf(isBytecodeInterpreterEnabled(), "disposes in reverse order after block exit even in same declaration", () => { + test.xfail("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.xfailIf(isBytecodeInterpreterEnabled(), "is run even after throw", () => { + test.xfail("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.xfailIf(isBytecodeInterpreterEnabled(), "throws error if dispose method does", () => { + test.xfail("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.xfailIf(isBytecodeInterpreterEnabled(), "if block and using throw get suppressed error", () => { + test.xfail("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.xfailIf(isBytecodeInterpreterEnabled(), "multiple throwing disposes give suppressed error", () => { + test.xfail("multiple throwing disposes give suppressed error", () => { let inCatch = false; try { { @@ -133,7 +133,7 @@ describe("behavior with exceptions", () => { expect(inCatch).toBeTrue(); }); - test.xfailIf(isBytecodeInterpreterEnabled(), "3 throwing disposes give chaining suppressed error", () => { + test.xfail("3 throwing disposes give chaining suppressed error", () => { let inCatch = false; try { { @@ -168,7 +168,7 @@ describe("behavior with exceptions", () => { expect(inCatch).toBeTrue(); }); - test.xfailIf(isBytecodeInterpreterEnabled(), "normal error and multiple disposing erorrs give chaining suppressed errors", () => { + test.xfail("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.xfailIf(isBytecodeInterpreterEnabled(), "works in block", () => { + test.xfail("works in block", () => { let dispose = false; expect(dispose).toBeFalse(); { @@ -210,7 +210,7 @@ describe("works in a bunch of scopes", () => { expect(dispose).toBeTrue(); }); - test.xfailIf(isBytecodeInterpreterEnabled(), "works in static class block", () => { + test.xfail("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.xfailIf(isBytecodeInterpreterEnabled(), "works in function", () => { + test.xfail("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.xfailIf(isBytecodeInterpreterEnabled(), "switch block is treated as full block in function", () => { + test.xfail("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.xfailIf(isBytecodeInterpreterEnabled(), "nullish values do not throw", () => { + test.xfail("nullish values do not throw", () => { using a = null, b = undefined; expect(a).toBeNull(); expect(b).toBeUndefined(); }); - test.xfailIf(isBytecodeInterpreterEnabled(), "non-object throws", () => { + test.xfail("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.xfailIf(isBytecodeInterpreterEnabled(), "object without dispose throws", () => { + test.xfail("object without dispose throws", () => { expect(() => { using a = {}; }).toThrowWithMessage(TypeError, "does not have dispose method"); }); - test.xfailIf(isBytecodeInterpreterEnabled(), "object with non callable dispose throws", () => { + test.xfail("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.xfailIf(isBytecodeInterpreterEnabled(), "using", () => { + test.xfail("using", () => { "use strict"; using using = null; expect(using).toBeNull(); diff --git a/Userland/Libraries/LibJS/Tests/using-for-loops.js b/Userland/Libraries/LibJS/Tests/using-for-loops.js index 59c8d48da4..68d41e4c05 100644 --- a/Userland/Libraries/LibJS/Tests/using-for-loops.js +++ b/Userland/Libraries/LibJS/Tests/using-for-loops.js @@ -1,5 +1,5 @@ describe("basic usage", () => { - test.xfailIf(isBytecodeInterpreterEnabled(), "using in normal for loop", () => { + test.xfail("using in normal for loop", () => { let isDisposed = false; let lastI = -1; for ( @@ -27,7 +27,7 @@ describe("basic usage", () => { expect(lastI).toBe(2); }); - test.xfailIf(isBytecodeInterpreterEnabled(), "using in normal for loop with expression body", () => { + test.xfail("using in normal for loop with expression body", () => { let isDisposed = false; let outerI = 0; for ( @@ -53,7 +53,7 @@ describe("basic usage", () => { expect(outerI).toBe(3); }); - test.xfailIf(isBytecodeInterpreterEnabled(), "using in for of loop", () => { + test.xfail("using in for of loop", () => { const disposable = []; const values = []; @@ -75,7 +75,7 @@ describe("basic usage", () => { expect(disposable).toEqual(['a', 'b', 'c']); }); - test.xfailIf(isBytecodeInterpreterEnabled(), "using in for of loop with expression body", () => { + test.xfail("using in for of loop with expression body", () => { let disposableCalls = 0; let i = 0; @@ -91,7 +91,7 @@ describe("basic usage", () => { expect(disposableCalls).toBe(3); }); - test.xfailIf(isBytecodeInterpreterEnabled(), "can have multiple declaration in normal for loop", () => { + test.xfail("can have multiple declaration in normal for loop", () => { let disposed = 0; const a = { [Symbol.dispose]() { @@ -106,7 +106,7 @@ describe("basic usage", () => { expect(disposed).toBe(2); }); - test.xfailIf(isBytecodeInterpreterEnabled(), "can have using in block in for loop", () => { + test.xfail("can have using in block in for loop", () => { const disposed = []; const values = []; for (let i = 0; i < 3; i++) { @@ -123,7 +123,7 @@ describe("basic usage", () => { expect(disposed).toEqual([0, 1, 2]); }); - test.xfailIf(isBytecodeInterpreterEnabled(), "can have using in block in for-in loop", () => { + test.xfail("can have using in block in for-in loop", () => { const disposed = []; const values = []; for (const i in ['a', 'b', 'c']) { @@ -140,7 +140,7 @@ describe("basic usage", () => { expect(disposed).toEqual(["0", "1", "2"]); }); - test.xfailIf(isBytecodeInterpreterEnabled(), "dispose is called even if throw in for of loop", () => { + test.xfail("dispose is called even if throw in for of loop", () => { let disposableCalls = 0; const obj = { @@ -209,7 +209,7 @@ describe("using is still a valid variable in loops", () => { expect(enteredLoop).toBeTrue(); }); - test.xfailIf(isBytecodeInterpreterEnabled(), "using using of", () => { + test.xfail("using using of", () => { let enteredLoop = false; for (using using of [null]) { enteredLoop = true;