Skip to content

Commit

Permalink
fixup: update error message
Browse files Browse the repository at this point in the history
  • Loading branch information
Trott committed Oct 9, 2015
1 parent c3672b0 commit 3b9e2be
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 23 deletions.
38 changes: 18 additions & 20 deletions test/parallel/test-stringbytes-external-at-max.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,25 @@ require('../common');
const assert = require('assert');

// v8 fails silently if string length > v8::String::kMaxLength
(function() {
// v8::String::kMaxLength defined in v8.h
const kStringMaxLength = process.binding('buffer').kStringMaxLength;
// v8::String::kMaxLength defined in v8.h
const kStringMaxLength = process.binding('buffer').kStringMaxLength;

try {
new Buffer(kStringMaxLength * 3);
} catch(e) {
assert.equal(e.message, 'Invalid array buffer length');
console.log(
'1..0 # Skipped: intensive toString tests due to memory confinements');
return;
}
try {
new Buffer(kStringMaxLength * 3);
} catch(e) {
assert.equal(e.message, 'Invalid typed array length');
console.log(
'1..0 # Skipped: intensive toString tests due to memory confinements');
return;
}

const buf = new Buffer(kStringMaxLength);
const buf = new Buffer(kStringMaxLength);

var maxString = buf.toString();
assert.equal(maxString.length, kStringMaxLength);
// Free the memory early instead of at the end of the next assignment
maxString = undefined;
var maxString = buf.toString();
assert.equal(maxString.length, kStringMaxLength);
// Free the memory early instead of at the end of the next assignment
maxString = undefined;

maxString = buf.toString('binary');
assert.equal(maxString.length, kStringMaxLength);
maxString = undefined;
})();
maxString = buf.toString('binary');
assert.equal(maxString.length, kStringMaxLength);
maxString = undefined;
2 changes: 1 addition & 1 deletion test/parallel/test-stringbytes-external-exceed-max-by-1.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const kStringMaxLength = process.binding('buffer').kStringMaxLength;
try {
new Buffer(kStringMaxLength * 3);
} catch(e) {
assert.equal(e.message, 'Invalid array buffer length');
assert.equal(e.message, 'Invalid typed array length');
console.log(
'1..0 # Skipped: intensive toString tests due to memory confinements');
return;
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-stringbytes-external-exceed-max-by-2.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const kStringMaxLength = process.binding('buffer').kStringMaxLength;
try {
new Buffer(kStringMaxLength * 3);
} catch(e) {
assert.equal(e.message, 'Invalid array buffer length');
assert.equal(e.message, 'Invalid typed array length');
console.log(
'1..0 # Skipped: intensive toString tests due to memory confinements');
return;
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-stringbytes-external-exceed-max.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const kStringMaxLength = process.binding('buffer').kStringMaxLength;
try {
new Buffer(kStringMaxLength * 3);
} catch(e) {
assert.equal(e.message, 'Invalid array buffer length');
assert.equal(e.message, 'Invalid typed array length');
console.log(
'1..0 # Skipped: intensive toString tests due to memory confinements');
return;
Expand Down

0 comments on commit 3b9e2be

Please sign in to comment.