From 4d4908dde31316462acae5caec8dfcbbf7a244bd Mon Sep 17 00:00:00 2001 From: Alexandre Szymocha Date: Sat, 28 Dec 2019 14:48:36 +0100 Subject: Fix: allow reading into a 0-length array (#3329) --- cli/js/files_test.ts | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'cli/js/files_test.ts') diff --git a/cli/js/files_test.ts b/cli/js/files_test.ts index 2eaa3b9be..cb33f6947 100644 --- a/cli/js/files_test.ts +++ b/cli/js/files_test.ts @@ -118,6 +118,10 @@ testPerm( const filename = tempDir + "hello.txt"; const file = await Deno.open(filename, "w+"); + // reading into an empty buffer should return 0 immediately + const bytesRead = await file.read(new Uint8Array(0)); + assert(bytesRead === 0); + // reading file into null buffer should throw an error let err; try { -- cgit v1.2.3