summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/unit/buffer_test.ts13
1 files changed, 13 insertions, 0 deletions
diff --git a/cli/tests/unit/buffer_test.ts b/cli/tests/unit/buffer_test.ts
index 445c946e2..41d7e4d7f 100644
--- a/cli/tests/unit/buffer_test.ts
+++ b/cli/tests/unit/buffer_test.ts
@@ -446,3 +446,16 @@ Deno.test(function testBufferBytesCopyFalseGrowExactBytes() {
assertEquals(actualBytes.byteLength, bufSize);
assertEquals(actualBytes.buffer.byteLength, actualBytes.byteLength);
});
+
+Deno.test(function testThrowsErrorWhenBufferExceedsMaxLength() {
+ const kStringMaxLengthPlusOne = 536870888 + 1;
+ const bytes = new Uint8Array(kStringMaxLengthPlusOne);
+
+ assertThrows(
+ () => {
+ new TextDecoder().decode(bytes);
+ },
+ TypeError,
+ "buffer exceeds maximum length",
+ );
+});