test: fix Buffer OOM error message
authorTrevor Norris <trev.norris@gmail.com>
Wed, 16 Sep 2015 19:03:33 +0000 (13:03 -0600)
committerJeremiah Senkpiel <fishrock123@rocketmail.com>
Wed, 16 Sep 2015 20:07:59 +0000 (16:07 -0400)
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>
test/parallel/test-buffer-slow.js
test/parallel/test-stringbytes-external.js

index e652a6a..d7b4f48 100644 (file)
@@ -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
index be0c90d..615dccc 100644 (file)
@@ -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;