From 3b9e2bee4c1ec328865d5d154d4c225d44560aa7 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 9 Oct 2015 15:34:42 -0700 Subject: [PATCH] fixup: update error message --- .../test-stringbytes-external-at-max.js | 38 +++++++++---------- ...st-stringbytes-external-exceed-max-by-1.js | 2 +- ...st-stringbytes-external-exceed-max-by-2.js | 2 +- .../test-stringbytes-external-exceed-max.js | 2 +- 4 files changed, 21 insertions(+), 23 deletions(-) diff --git a/test/parallel/test-stringbytes-external-at-max.js b/test/parallel/test-stringbytes-external-at-max.js index 2d47726bc37f5e..ffee40793d7da2 100644 --- a/test/parallel/test-stringbytes-external-at-max.js +++ b/test/parallel/test-stringbytes-external-at-max.js @@ -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; diff --git a/test/parallel/test-stringbytes-external-exceed-max-by-1.js b/test/parallel/test-stringbytes-external-exceed-max-by-1.js index 8e2a5bf01f2596..6dc3252e144758 100644 --- a/test/parallel/test-stringbytes-external-exceed-max-by-1.js +++ b/test/parallel/test-stringbytes-external-exceed-max-by-1.js @@ -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; diff --git a/test/parallel/test-stringbytes-external-exceed-max-by-2.js b/test/parallel/test-stringbytes-external-exceed-max-by-2.js index 879e4ae91dfb60..bcb19adf2f41f8 100644 --- a/test/parallel/test-stringbytes-external-exceed-max-by-2.js +++ b/test/parallel/test-stringbytes-external-exceed-max-by-2.js @@ -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; diff --git a/test/parallel/test-stringbytes-external-exceed-max.js b/test/parallel/test-stringbytes-external-exceed-max.js index 0a6f585b66f3ad..0adcd58547f7c4 100644 --- a/test/parallel/test-stringbytes-external-exceed-max.js +++ b/test/parallel/test-stringbytes-external-exceed-max.js @@ -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;