Skip to content

Commit

Permalink
test: update ArrayBuffer alloc failure message
Browse files Browse the repository at this point in the history
The error message returned on ArrayBuffer allocation failure is now different
as per https://codereview.chromium.org/1393263003.

Ref: nodejs#4399
PR-URL: nodejs#4785
Reviewed-By: bnoordhuis - Ben Noordhuis <[email protected]>
  • Loading branch information
ofrobots authored and Michael Scovetta committed Apr 2, 2016
1 parent 8663738 commit 4a40b01
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 10 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, 'Invalid array buffer length');
assert.equal(e.message, 'Array buffer allocation failed');
}

// should work with number-coercible values
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-stringbytes-external-at-max.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ try {
gc();
} catch (e) {
// If the exception is not due to memory confinement then rethrow it.
if (e.message !== 'Invalid array buffer length') throw (e);
if (e.message !== 'Array buffer allocation failed') throw (e);
console.log(skipMessage);
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ try {
gc();
} catch (e) {
// If the exception is not due to memory confinement then rethrow it.
if (e.message !== 'Invalid array buffer length') throw (e);
if (e.message !== 'Array buffer allocation failed') throw (e);
console.log(skipMessage);
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ try {
gc();
} catch (e) {
// If the exception is not due to memory confinement then rethrow it.
if (e.message !== 'Invalid array buffer length') throw (e);
if (e.message !== 'Array buffer allocation failed') throw (e);
console.log(skipMessage);
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ try {
gc();
} catch (e) {
// If the exception is not due to memory confinement then rethrow it.
if (e.message !== 'Invalid array buffer length') throw (e);
if (e.message !== 'Array buffer allocation failed') throw (e);
console.log(skipMessage);
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ try {
gc();
} catch (e) {
// If the exception is not due to memory confinement then rethrow it.
if (e.message !== 'Invalid array buffer length') throw (e);
if (e.message !== 'Array buffer allocation failed') throw (e);
console.log(skipMessage);
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ try {
gc();
} catch (e) {
// If the exception is not due to memory confinement then rethrow it.
if (e.message !== 'Invalid array buffer length') throw (e);
if (e.message !== 'Array buffer allocation failed') throw (e);
console.log(skipMessage);
return;
}

assert.throws(function() {
buf.toString();
}, /"toString\(\)" failed|Invalid array buffer length/);
}, /"toString\(\)" failed|Array buffer allocation failed/);

assert.throws(function() {
buf.toString('utf8');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ try {
gc();
} catch (e) {
// If the exception is not due to memory confinement then rethrow it.
if (e.message !== 'Invalid array buffer length') throw (e);
if (e.message !== 'Array buffer allocation failed') throw (e);
console.log(skipMessage);
return;
}
Expand Down
2 changes: 1 addition & 1 deletion test/sequential/test-stringbytes-external-exceed-max.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ try {
gc();
} catch (e) {
// If the exception is not due to memory confinement then rethrow it.
if (e.message !== 'Invalid array buffer length') throw (e);
if (e.message !== 'Array buffer allocation failed') throw (e);
console.log(skipMessage);
return;
}
Expand Down

0 comments on commit 4a40b01

Please sign in to comment.