summaryrefslogtreecommitdiff
path: root/cli/tests/unit/console_test.ts
diff options
context:
space:
mode:
authorud2 <sjx233@qq.com>2023-06-06 17:06:00 +0800
committerGitHub <noreply@github.com>2023-06-06 11:06:00 +0200
commit2052ba343c0b222cf638e32f15622a237e423317 (patch)
treeb887b00df825e2de5d12c0734ca645c2306f1319 /cli/tests/unit/console_test.ts
parent0bbdbace02d8b17a02bd3c631b82f508d0effa4a (diff)
fix(ext/console): fix inspecting large ArrayBuffers (#19373)
Diffstat (limited to 'cli/tests/unit/console_test.ts')
-rw-r--r--cli/tests/unit/console_test.ts25
1 files changed, 25 insertions, 0 deletions
diff --git a/cli/tests/unit/console_test.ts b/cli/tests/unit/console_test.ts
index b177b956b..4cedf3584 100644
--- a/cli/tests/unit/console_test.ts
+++ b/cli/tests/unit/console_test.ts
@@ -2193,6 +2193,31 @@ Deno.test(function inspectEmptyUint8Array() {
);
});
+Deno.test(function inspectLargeArrayBuffer() {
+ const arrayBuffer = new ArrayBuffer(2 ** 32 + 1);
+ assertEquals(
+ Deno.inspect(arrayBuffer),
+ `ArrayBuffer {
+ [Uint8Contents]: <00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ... 4294967197 more bytes>,
+ byteLength: 4294967297
+}`,
+ );
+ structuredClone(arrayBuffer, { transfer: [arrayBuffer] });
+ assertEquals(
+ Deno.inspect(arrayBuffer),
+ "ArrayBuffer { (detached), byteLength: 0 }",
+ );
+
+ const sharedArrayBuffer = new SharedArrayBuffer(2 ** 32 + 1);
+ assertEquals(
+ Deno.inspect(sharedArrayBuffer),
+ `SharedArrayBuffer {
+ [Uint8Contents]: <00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ... 4294967197 more bytes>,
+ byteLength: 4294967297
+}`,
+ );
+});
+
Deno.test(function inspectStringAbbreviation() {
const LONG_STRING =
"This is a really long string which will be abbreviated with ellipsis.";