summaryrefslogtreecommitdiff
path: root/js/buffer_test.ts
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2018-11-27 21:46:24 +0100
committerRyan Dahl <ry@tinyclouds.org>2018-11-27 13:14:24 -0800
commitb183b01c8e6ead0bf5e134e115c5a0fcb3aab367 (patch)
tree29019ab9c88eb598eaf66588ee41cfe7d9bb6ddb /js/buffer_test.ts
parent9ca92bd51bb9a1eb5ceda4daf3ebc2116a39a296 (diff)
add test for Buffer edge case
Diffstat (limited to 'js/buffer_test.ts')
-rw-r--r--js/buffer_test.ts10
1 files changed, 10 insertions, 0 deletions
diff --git a/js/buffer_test.ts b/js/buffer_test.ts
index c614b2e03..843a85f97 100644
--- a/js/buffer_test.ts
+++ b/js/buffer_test.ts
@@ -109,6 +109,16 @@ test(async function bufferBasicOperations() {
}
});
+test(async function bufferReadEmptyAtEOF() {
+ // check that EOF of 'buf' is not reached (even though it's empty) if
+ // results are written to buffer that has 0 length (ie. it can't store any data)
+ let buf = new Buffer();
+ const zeroLengthTmp = new Uint8Array(0);
+ let result = await buf.read(zeroLengthTmp);
+ assertEqual(result.nread, 0);
+ assertEqual(result.eof, false);
+});
+
test(async function bufferLargeByteWrites() {
init();
const buf = new Buffer();