mirror of
https://github.com/nodejs/node.git
synced 2026-11-21 12:59:16 -05:00
test: assert write return values in buffer-bigint64
PR-URL: https://github.com/nodejs/node/pull/57212 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
1 parent
424aacc942
commit
64fdfd5622
1 file changed
+6
-1
@@ -2,7 +2,7 @@
|
||||
require('../common');
|
||||
const assert = require('assert');
|
||||
|
||||
const buf = Buffer.allocUnsafe(8);
|
||||
const buf = Buffer.allocUnsafe(9);
|
||||
|
||||
['LE', 'BE'].forEach(function(endianness) {
|
||||
// Should allow simple BigInts to be written and read
|
||||
@@ -27,6 +27,11 @@ const buf = Buffer.allocUnsafe(8);
|
||||
buf[`writeBigUInt64${endianness}`](val, 0);
|
||||
assert.strictEqual(val, buf[`readBigUInt64${endianness}`](0));
|
||||
|
||||
assert.strictEqual(buf[`writeBigUInt64${endianness}`](val, 0), 8);
|
||||
assert.strictEqual(buf[`writeBigInt64${endianness}`](val, 0), 8);
|
||||
assert.strictEqual(buf[`writeBigUInt64${endianness}`](val, 1), 9);
|
||||
assert.strictEqual(buf[`writeBigInt64${endianness}`](val, 1), 9);
|
||||
|
||||
// Should throw a RangeError upon INT64_MAX+1 being written
|
||||
assert.throws(function() {
|
||||
const val = 0x8000000000000000n;
|
||||
|
||||
Reference in new issue
Block a user