Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fixup
  • Loading branch information
jazelly committed Aug 28, 2024
commit 93befdfa1e362af731b3657add6b589ffcb9a9d2
11 changes: 7 additions & 4 deletions test/parallel/test-buffer-tostring-range.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

require('../common');
const common = require('../common');
const assert = require('assert');

const rangeBuffer = Buffer.from('abc');
Expand Down Expand Up @@ -99,7 +99,10 @@ assert.throws(() => {
message: 'Unknown encoding: null'
});


const largeBuffer = Buffer.alloc(2 ** 32);
// Must not throw when start and end are within kMaxLength
largeBuffer.toString('utf8', 2 ** 31 + 1, 2 ** 31 + 10);
// Cannot test on 32bit machine as we are testing the case
// when start and end are above the threshold
common.skipIf32Bits();
const threshold = 0xFFFFFFFF;
const largeBuffer = Buffer.alloc(threshold + 20);
largeBuffer.toString('utf8', threshold, threshold + 20);