mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-24 18:28:57 +00:00
LibJS: Implement initializing a TypedArray from an array-like object
Used by twitch.tv and based on the following specification: https://tc39.es/ecma262/#sec-initializetypedarrayfromarraylike
This commit is contained in:
parent
c9196995be
commit
06a2173586
Notes:
sideshowbarker
2024-07-18 22:57:59 +09:00
Author: https://github.com/IdanHo
Commit: 06a2173586
Pull-request: https://github.com/SerenityOS/serenity/pull/6383
Reviewed-by: https://github.com/awesomekling
Reviewed-by: https://github.com/linusg ✅
2 changed files with 54 additions and 2 deletions
|
@ -183,6 +183,18 @@ test("typed array created from TypedArray do not share buffer", () => {
|
|||
expect(u8Array[1]).toBe(2);
|
||||
});
|
||||
|
||||
test("typed array from Array-Like", () => {
|
||||
TYPED_ARRAYS.forEach(T => {
|
||||
function func() {
|
||||
const newTypedArray = new T(arguments);
|
||||
expect(newTypedArray[0]).toBe(1);
|
||||
expect(newTypedArray[1]).toBe(2);
|
||||
expect(newTypedArray[2]).toBe(3);
|
||||
}
|
||||
func(1, 2, 3);
|
||||
});
|
||||
});
|
||||
|
||||
test("TypedArray is not exposed on the global object", () => {
|
||||
expect(globalThis.TypedArray).toBeUndefined();
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue