Skip to content

Commit 079a217

Browse files
trevnorrisFishrock123
authored andcommitted
test: fix Buffer OOM error message
Now that Buffers instantiate the Uint8Array in JS the error message has changed in case the allocation fails due to OOM. Tests have been updated to match. PR-URL: #2915 Reviewed-By: Jeremiah Senkpiel <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
1 parent 8e58434 commit 079a217

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

test/parallel/test-buffer-slow.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ assert.strictEqual(SlowBuffer(0).length, 0);
3030
try {
3131
assert.strictEqual(SlowBuffer(buffer.kMaxLength).length, buffer.kMaxLength);
3232
} catch (e) {
33-
assert.equal(e.message, 'Buffer allocation failed - process out of memory');
33+
assert.equal(e.message, 'Invalid array buffer length');
3434
}
3535

3636
// should work with number-coercible values

test/parallel/test-stringbytes-external.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,12 @@ var PRE_3OF4_APEX = Math.ceil((EXTERN_APEX / 4) * 3) - RADIOS;
115115

116116
assert.throws(function() {
117117
new Buffer(kStringMaxLength + 1).toString();
118-
}, /toString failed|Buffer allocation failed/);
118+
}, /toString failed|Invalid array buffer length/);
119119

120120
try {
121121
new Buffer(kStringMaxLength * 4);
122122
} catch(e) {
123-
assert.equal(e.message, 'Buffer allocation failed - process out of memory');
123+
assert.equal(e.message, 'Invalid array buffer length');
124124
console.log(
125125
'1..0 # Skipped: intensive toString tests due to memory confinements');
126126
return;

0 commit comments

Comments
 (0)