Skip to content

Commit

Permalink
test: fix Buffer OOM error message
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
trevnorris authored and Fishrock123 committed Sep 16, 2015
1 parent 8e58434 commit 079a217
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion test/parallel/test-buffer-slow.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ assert.strictEqual(SlowBuffer(0).length, 0);
try {
assert.strictEqual(SlowBuffer(buffer.kMaxLength).length, buffer.kMaxLength);
} catch (e) {
assert.equal(e.message, 'Buffer allocation failed - process out of memory');
assert.equal(e.message, 'Invalid array buffer length');
}

// should work with number-coercible values
Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-stringbytes-external.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,12 @@ var PRE_3OF4_APEX = Math.ceil((EXTERN_APEX / 4) * 3) - RADIOS;

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

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

0 comments on commit 079a217

Please sign in to comment.