Browse Source

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: https://github.com/nodejs/node/pull/2915
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
v5.x
Trevor Norris 9 years ago
parent
commit
71c53b6790
  1. 2
      test/parallel/test-buffer-slow.js
  2. 4
      test/parallel/test-stringbytes-external.js

2
test/parallel/test-buffer-slow.js

@ -30,7 +30,7 @@ assert.strictEqual(SlowBuffer(0).length, 0);
try { try {
assert.strictEqual(SlowBuffer(buffer.kMaxLength).length, buffer.kMaxLength); assert.strictEqual(SlowBuffer(buffer.kMaxLength).length, buffer.kMaxLength);
} catch (e) { } 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 // should work with number-coercible values

4
test/parallel/test-stringbytes-external.js

@ -115,12 +115,12 @@ var PRE_3OF4_APEX = Math.ceil((EXTERN_APEX / 4) * 3) - RADIOS;
assert.throws(function() { assert.throws(function() {
new Buffer(kStringMaxLength + 1).toString(); new Buffer(kStringMaxLength + 1).toString();
}, /toString failed|Buffer allocation failed/); }, /toString failed|Invalid array buffer length/);
try { try {
new Buffer(kStringMaxLength * 4); new Buffer(kStringMaxLength * 4);
} catch(e) { } catch(e) {
assert.equal(e.message, 'Buffer allocation failed - process out of memory'); assert.equal(e.message, 'Invalid array buffer length');
console.log( console.log(
'1..0 # Skipped: intensive toString tests due to memory confinements'); '1..0 # Skipped: intensive toString tests due to memory confinements');
return; return;

Loading…
Cancel
Save