mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-24 11:11:51 +00:00
LibJS: Add ArrayBuffer
This commit is contained in:
parent
cf9da66b3e
commit
32571dfa53
Notes:
sideshowbarker
2024-07-19 01:05:04 +09:00
Author: https://github.com/linusg
Commit: 32571dfa53
Pull-request: https://github.com/SerenityOS/serenity/pull/4307
14 changed files with 426 additions and 11 deletions
|
@ -0,0 +1,18 @@
|
|||
// Update when more typed arrays get added
|
||||
const TYPED_ARRAYS = [Uint8Array, Uint16Array, Uint32Array, Int8Array, Int16Array, Int32Array];
|
||||
|
||||
test("basic functionality", () => {
|
||||
expect(ArrayBuffer.isView).toHaveLength(1);
|
||||
|
||||
expect(ArrayBuffer.isView()).toBeFalse();
|
||||
expect(ArrayBuffer.isView(null)).toBeFalse();
|
||||
expect(ArrayBuffer.isView(undefined)).toBeFalse();
|
||||
expect(ArrayBuffer.isView([])).toBeFalse();
|
||||
expect(ArrayBuffer.isView({})).toBeFalse();
|
||||
expect(ArrayBuffer.isView(123)).toBeFalse();
|
||||
expect(ArrayBuffer.isView("foo")).toBeFalse();
|
||||
expect(ArrayBuffer.isView(new ArrayBuffer())).toBeFalse();
|
||||
TYPED_ARRAYS.forEach(T => {
|
||||
expect(ArrayBuffer.isView(new T())).toBeTrue();
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue