Skip to content

Commit eb3576f

Browse files
nektroaduh95
authored andcommitted
test: assert write return values in buffer-bigint64
PR-URL: #57212 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 6a2e4c5 commit eb3576f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

test/parallel/test-buffer-bigint64.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
require('../common');
33
const assert = require('assert');
44

5-
const buf = Buffer.allocUnsafe(8);
5+
const buf = Buffer.allocUnsafe(9);
66

77
['LE', 'BE'].forEach(function(endianness) {
88
// Should allow simple BigInts to be written and read
@@ -27,6 +27,11 @@ const buf = Buffer.allocUnsafe(8);
2727
buf[`writeBigUInt64${endianness}`](val, 0);
2828
assert.strictEqual(val, buf[`readBigUInt64${endianness}`](0));
2929

30+
assert.strictEqual(buf[`writeBigUInt64${endianness}`](val, 0), 8);
31+
assert.strictEqual(buf[`writeBigInt64${endianness}`](val, 0), 8);
32+
assert.strictEqual(buf[`writeBigUInt64${endianness}`](val, 1), 9);
33+
assert.strictEqual(buf[`writeBigInt64${endianness}`](val, 1), 9);
34+
3035
// Should throw a RangeError upon INT64_MAX+1 being written
3136
assert.throws(function() {
3237
const val = 0x8000000000000000n;

0 commit comments

Comments
 (0)