mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-13 04:52:23 +00:00
Everywhere: Hoist the Libraries folder to the top-level
This commit is contained in:
parent
950e819ee7
commit
93712b24bf
Notes:
github-actions[bot]
2024-11-10 11:51:52 +00:00
Author: https://github.com/trflynn89
Commit: 93712b24bf
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2256
Reviewed-by: https://github.com/sideshowbarker
4547 changed files with 104 additions and 113 deletions
76
Libraries/LibJS/Tests/builtins/Atomics/Atomics.waitAsync.js
Normal file
76
Libraries/LibJS/Tests/builtins/Atomics/Atomics.waitAsync.js
Normal file
|
@ -0,0 +1,76 @@
|
|||
describe("errors", () => {
|
||||
test("called on non-TypedArray", () => {
|
||||
expect(() => {
|
||||
Atomics.waitAsync(Symbol.hasInstance, 0, 0, 0);
|
||||
}).toThrowWithMessage(TypeError, "Not an object of type TypedArray");
|
||||
});
|
||||
|
||||
test("detached buffer", () => {
|
||||
expect(() => {
|
||||
const typedArray = new Int32Array(4);
|
||||
detachArrayBuffer(typedArray.buffer);
|
||||
|
||||
Atomics.waitAsync(typedArray, 0, 0, 0);
|
||||
}).toThrowWithMessage(
|
||||
TypeError,
|
||||
"TypedArray contains a property which references a value at an index not contained within its buffer's bounds"
|
||||
);
|
||||
});
|
||||
|
||||
test("invalid TypedArray type", () => {
|
||||
expect(() => {
|
||||
const typedArray = new Float32Array(4);
|
||||
Atomics.waitAsync(typedArray, 0, 0, 0);
|
||||
}).toThrowWithMessage(
|
||||
TypeError,
|
||||
"Typed array Float32Array element type is not Int32 or BigInt64"
|
||||
);
|
||||
});
|
||||
|
||||
test("non-shared ArrayBuffer", () => {
|
||||
expect(() => {
|
||||
const typedArray = new Int32Array(4);
|
||||
Atomics.waitAsync(typedArray, 0, 0, 0);
|
||||
}).toThrowWithMessage(TypeError, "The array buffer object must be a SharedArrayBuffer");
|
||||
});
|
||||
|
||||
test("invalid index", () => {
|
||||
expect(() => {
|
||||
const buffer = new SharedArrayBuffer(4 * Int32Array.BYTES_PER_ELEMENT);
|
||||
const typedArray = new Int32Array(buffer);
|
||||
|
||||
Atomics.waitAsync(typedArray, 4, 0, 0);
|
||||
}).toThrowWithMessage(RangeError, "Index 4 is out of range of array length 4");
|
||||
});
|
||||
|
||||
test("invalid value", () => {
|
||||
expect(() => {
|
||||
const buffer = new SharedArrayBuffer(4 * Int32Array.BYTES_PER_ELEMENT);
|
||||
const typedArray = new Int32Array(buffer);
|
||||
|
||||
Atomics.waitAsync(typedArray, 0, Symbol.hasInstance, 0);
|
||||
}).toThrowWithMessage(TypeError, "Cannot convert symbol to number");
|
||||
|
||||
expect(() => {
|
||||
const buffer = new SharedArrayBuffer(4 * BigInt64Array.BYTES_PER_ELEMENT);
|
||||
const typedArray = new BigInt64Array(buffer);
|
||||
|
||||
Atomics.waitAsync(typedArray, 0, Symbol.hasInstance, 0);
|
||||
}).toThrowWithMessage(TypeError, "Cannot convert symbol to BigInt");
|
||||
});
|
||||
|
||||
test("invalid timeout", () => {
|
||||
expect(() => {
|
||||
const buffer = new SharedArrayBuffer(4 * Int32Array.BYTES_PER_ELEMENT);
|
||||
const typedArray = new Int32Array(buffer);
|
||||
|
||||
Atomics.waitAsync(typedArray, 0, 0, Symbol.hasInstance);
|
||||
}).toThrowWithMessage(TypeError, "Cannot convert symbol to number");
|
||||
});
|
||||
});
|
||||
|
||||
test("basic functionality", () => {
|
||||
test("invariants", () => {
|
||||
expect(Atomics.waitAsync).toHaveLength(4);
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue