test: fix tests that check error messages
20285ad17755187ece16b8a5effeaa87f5407da2 changed the format of error messages throughout lib. However, the tests were not updated to reflect these changes. This commit makes those changes. PR-URL: https://github.com/nodejs/node/pull/3727 Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Johan Bergström <bugs@bergstroem.nu> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
7b89a3de69
commit
2c33819370
@ -566,7 +566,7 @@ posix.extname = function(path) {
|
|||||||
posix.format = function(pathObject) {
|
posix.format = function(pathObject) {
|
||||||
if (pathObject === null || typeof pathObject !== 'object') {
|
if (pathObject === null || typeof pathObject !== 'object') {
|
||||||
throw new TypeError(
|
throw new TypeError(
|
||||||
"Parameter 'pathObject' must be an object, not " + typeof pathObject
|
'Parameter "pathObject" must be an object, not ' + typeof pathObject
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -438,7 +438,8 @@ function testBlockTypeError(method, block) {
|
|||||||
method(block);
|
method(block);
|
||||||
threw = false;
|
threw = false;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
assert.equal(e.toString(), 'TypeError: block must be a function');
|
assert.equal(e.toString(),
|
||||||
|
'TypeError: "block" argument must be a function');
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.ok(threw);
|
assert.ok(threw);
|
||||||
|
@ -1222,11 +1222,11 @@ assert.throws(function() {
|
|||||||
|
|
||||||
assert.throws(function() {
|
assert.throws(function() {
|
||||||
new Buffer();
|
new Buffer();
|
||||||
}, /must start with number, buffer, array or string/);
|
}, /Must start with number, buffer, array or string/);
|
||||||
|
|
||||||
assert.throws(function() {
|
assert.throws(function() {
|
||||||
new Buffer(null);
|
new Buffer(null);
|
||||||
}, /must start with number, buffer, array or string/);
|
}, /Must start with number, buffer, array or string/);
|
||||||
|
|
||||||
|
|
||||||
// Test prototype getters don't throw
|
// Test prototype getters don't throw
|
||||||
|
@ -8,7 +8,7 @@ const common = require('../common');
|
|||||||
const cmd = common.isWindows ? 'rundll32' : 'ls';
|
const cmd = common.isWindows ? 'rundll32' : 'ls';
|
||||||
const invalidcmd = 'hopefully_you_dont_have_this_on_your_machine';
|
const invalidcmd = 'hopefully_you_dont_have_this_on_your_machine';
|
||||||
const invalidArgsMsg = /Incorrect value of args option/;
|
const invalidArgsMsg = /Incorrect value of args option/;
|
||||||
const invalidOptionsMsg = /options argument must be an object/;
|
const invalidOptionsMsg = /"options" argument must be an object/;
|
||||||
const empty = common.fixturesDir + '/empty.js';
|
const empty = common.fixturesDir + '/empty.js';
|
||||||
|
|
||||||
assert.throws(function() {
|
assert.throws(function() {
|
||||||
|
@ -178,7 +178,7 @@ function run_test_4() {
|
|||||||
function() {
|
function() {
|
||||||
file = fs.createWriteStream(filepath, options);
|
file = fs.createWriteStream(filepath, options);
|
||||||
},
|
},
|
||||||
/start must be/
|
/"start" must be/
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -96,11 +96,11 @@ assert.throws(function() {
|
|||||||
|
|
||||||
assert.throws(function() {
|
assert.throws(function() {
|
||||||
fs.access(__filename, fs.F_OK);
|
fs.access(__filename, fs.F_OK);
|
||||||
}, /callback must be a function/);
|
}, /"callback" argument must be a function/);
|
||||||
|
|
||||||
assert.throws(function() {
|
assert.throws(function() {
|
||||||
fs.access(__filename, fs.F_OK, {});
|
fs.access(__filename, fs.F_OK, {});
|
||||||
}, /callback must be a function/);
|
}, /"callback" argument must be a function/);
|
||||||
|
|
||||||
assert.doesNotThrow(function() {
|
assert.doesNotThrow(function() {
|
||||||
fs.accessSync(__filename);
|
fs.accessSync(__filename);
|
||||||
|
@ -4,7 +4,7 @@ var assert = require('assert');
|
|||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
|
|
||||||
function check(async, sync) {
|
function check(async, sync) {
|
||||||
var expected = /Path must be a string without null bytes./;
|
var expected = /Path must be a string without null bytes/;
|
||||||
var argsSync = Array.prototype.slice.call(arguments, 2);
|
var argsSync = Array.prototype.slice.call(arguments, 2);
|
||||||
var argsAsync = argsSync.concat(function(er) {
|
var argsAsync = argsSync.concat(function(er) {
|
||||||
assert(er && er.message.match(expected));
|
assert(er && er.message.match(expected));
|
||||||
|
@ -29,7 +29,7 @@ stream.on('finish', common.mustCall(function() {
|
|||||||
fd = fs.openSync(file, 'r');
|
fd = fs.openSync(file, 'r');
|
||||||
fs.read(fd, kStringMaxLength + 1, 0, 'utf8', common.mustCall(function(err) {
|
fs.read(fd, kStringMaxLength + 1, 0, 'utf8', common.mustCall(function(err) {
|
||||||
assert.ok(err instanceof Error);
|
assert.ok(err instanceof Error);
|
||||||
assert.strictEqual('toString failed', err.message);
|
assert.strictEqual('"toString()" failed', err.message);
|
||||||
}));
|
}));
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ file6.on('end', function() {
|
|||||||
|
|
||||||
assert.throws(function() {
|
assert.throws(function() {
|
||||||
fs.createReadStream(rangeFile, Object.create({start: 10, end: 2}));
|
fs.createReadStream(rangeFile, Object.create({start: 10, end: 2}));
|
||||||
}, /start must be <= end/);
|
}, /"start" option must be <= "end" option/);
|
||||||
|
|
||||||
var stream = fs.createReadStream(rangeFile, Object.create({ start: 0,
|
var stream = fs.createReadStream(rangeFile, Object.create({ start: 0,
|
||||||
end: 0 }));
|
end: 0 }));
|
||||||
|
@ -18,16 +18,16 @@ assert.doesNotThrow(function() {
|
|||||||
|
|
||||||
assert.throws(function() {
|
assert.throws(function() {
|
||||||
fs.createReadStream(example, null);
|
fs.createReadStream(example, null);
|
||||||
}, /options must be a string or an object/);
|
}, /"options" argument must be a string or an object/);
|
||||||
assert.throws(function() {
|
assert.throws(function() {
|
||||||
fs.createReadStream(example, 123);
|
fs.createReadStream(example, 123);
|
||||||
}, /options must be a string or an object/);
|
}, /"options" argument must be a string or an object/);
|
||||||
assert.throws(function() {
|
assert.throws(function() {
|
||||||
fs.createReadStream(example, 0);
|
fs.createReadStream(example, 0);
|
||||||
}, /options must be a string or an object/);
|
}, /"options" argument must be a string or an object/);
|
||||||
assert.throws(function() {
|
assert.throws(function() {
|
||||||
fs.createReadStream(example, true);
|
fs.createReadStream(example, true);
|
||||||
}, /options must be a string or an object/);
|
}, /"options" argument must be a string or an object/);
|
||||||
assert.throws(function() {
|
assert.throws(function() {
|
||||||
fs.createReadStream(example, false);
|
fs.createReadStream(example, false);
|
||||||
}, /options must be a string or an object/);
|
}, /"options" argument must be a string or an object/);
|
||||||
|
@ -107,7 +107,7 @@ file6.on('end', function() {
|
|||||||
|
|
||||||
assert.throws(function() {
|
assert.throws(function() {
|
||||||
fs.createReadStream(rangeFile, {start: 10, end: 2});
|
fs.createReadStream(rangeFile, {start: 10, end: 2});
|
||||||
}, /start must be <= end/);
|
}, /"start" option must be <= "end" option/);
|
||||||
|
|
||||||
var stream = fs.createReadStream(rangeFile, { start: 0, end: 0 });
|
var stream = fs.createReadStream(rangeFile, { start: 0, end: 0 });
|
||||||
stream.data = '';
|
stream.data = '';
|
||||||
|
@ -25,7 +25,7 @@ stream.on('finish', common.mustCall(function() {
|
|||||||
// make sure that the toString does not throw an error
|
// make sure that the toString does not throw an error
|
||||||
fs.readFile(file, 'utf8', common.mustCall(function(err, buf) {
|
fs.readFile(file, 'utf8', common.mustCall(function(err, buf) {
|
||||||
assert.ok(err instanceof Error);
|
assert.ok(err instanceof Error);
|
||||||
assert.strictEqual('toString failed', err.message);
|
assert.strictEqual('"toString()" failed', err.message);
|
||||||
}));
|
}));
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -8,11 +8,11 @@ const assert = require('assert');
|
|||||||
// Basic usage tests.
|
// Basic usage tests.
|
||||||
assert.throws(function() {
|
assert.throws(function() {
|
||||||
fs.watchFile('./some-file');
|
fs.watchFile('./some-file');
|
||||||
}, /watchFile requires a listener function/);
|
}, /"watchFile\(\)" requires a listener function/);
|
||||||
|
|
||||||
assert.throws(function() {
|
assert.throws(function() {
|
||||||
fs.watchFile('./another-file', {}, 'bad listener');
|
fs.watchFile('./another-file', {}, 'bad listener');
|
||||||
}, /watchFile requires a listener function/);
|
}, /"watchFile\(\)" requires a listener function/);
|
||||||
|
|
||||||
assert.throws(function() {
|
assert.throws(function() {
|
||||||
fs.watchFile(new Object(), function() {});
|
fs.watchFile(new Object(), function() {});
|
||||||
|
@ -20,16 +20,16 @@ assert.doesNotThrow(function() {
|
|||||||
|
|
||||||
assert.throws(function() {
|
assert.throws(function() {
|
||||||
fs.createWriteStream(example, null);
|
fs.createWriteStream(example, null);
|
||||||
}, /options must be a string or an object/);
|
}, /"options" argument must be a string or an object/);
|
||||||
assert.throws(function() {
|
assert.throws(function() {
|
||||||
fs.createWriteStream(example, 123);
|
fs.createWriteStream(example, 123);
|
||||||
}, /options must be a string or an object/);
|
}, /"options" argument must be a string or an object/);
|
||||||
assert.throws(function() {
|
assert.throws(function() {
|
||||||
fs.createWriteStream(example, 0);
|
fs.createWriteStream(example, 0);
|
||||||
}, /options must be a string or an object/);
|
}, /"options" argument must be a string or an object/);
|
||||||
assert.throws(function() {
|
assert.throws(function() {
|
||||||
fs.createWriteStream(example, true);
|
fs.createWriteStream(example, true);
|
||||||
}, /options must be a string or an object/);
|
}, /"options" argument must be a string or an object/);
|
||||||
assert.throws(function() {
|
assert.throws(function() {
|
||||||
fs.createWriteStream(example, false);
|
fs.createWriteStream(example, false);
|
||||||
}, /options must be a string or an object/);
|
}, /"options" argument must be a string or an object/);
|
||||||
|
@ -10,7 +10,7 @@ assert.throws(function() {
|
|||||||
}, function(err) {
|
}, function(err) {
|
||||||
if (err instanceof Error) {
|
if (err instanceof Error) {
|
||||||
assert.strictEqual(err.message, 'Protocol "file:" not supported.' +
|
assert.strictEqual(err.message, 'Protocol "file:" not supported.' +
|
||||||
' Expected "http:".');
|
' Expected "http:"');
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -20,7 +20,7 @@ assert.throws(function() {
|
|||||||
}, function(err) {
|
}, function(err) {
|
||||||
if (err instanceof Error) {
|
if (err instanceof Error) {
|
||||||
assert.strictEqual(err.message, 'Protocol "mailto:" not supported.' +
|
assert.strictEqual(err.message, 'Protocol "mailto:" not supported.' +
|
||||||
' Expected "http:".');
|
' Expected "http:"');
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -30,7 +30,7 @@ assert.throws(function() {
|
|||||||
}, function(err) {
|
}, function(err) {
|
||||||
if (err instanceof Error) {
|
if (err instanceof Error) {
|
||||||
assert.strictEqual(err.message, 'Protocol "ftp:" not supported.' +
|
assert.strictEqual(err.message, 'Protocol "ftp:" not supported.' +
|
||||||
' Expected "http:".');
|
' Expected "http:"');
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -40,7 +40,7 @@ assert.throws(function() {
|
|||||||
}, function(err) {
|
}, function(err) {
|
||||||
if (err instanceof Error) {
|
if (err instanceof Error) {
|
||||||
assert.strictEqual(err.message, 'Protocol "javascript:" not supported.' +
|
assert.strictEqual(err.message, 'Protocol "javascript:" not supported.' +
|
||||||
' Expected "http:".');
|
' Expected "http:"');
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -50,7 +50,7 @@ assert.throws(function() {
|
|||||||
}, function(err) {
|
}, function(err) {
|
||||||
if (err instanceof Error) {
|
if (err instanceof Error) {
|
||||||
assert.strictEqual(err.message, 'Protocol "xmpp:" not supported.' +
|
assert.strictEqual(err.message, 'Protocol "xmpp:" not supported.' +
|
||||||
' Expected "http:".');
|
' Expected "http:"');
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -60,7 +60,7 @@ assert.throws(function() {
|
|||||||
}, function(err) {
|
}, function(err) {
|
||||||
if (err instanceof Error) {
|
if (err instanceof Error) {
|
||||||
assert.strictEqual(err.message, 'Protocol "f:" not supported.' +
|
assert.strictEqual(err.message, 'Protocol "f:" not supported.' +
|
||||||
' Expected "http:".');
|
' Expected "http:"');
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -25,7 +25,7 @@ var s = http.createServer(function(req, res) {
|
|||||||
res.setHeader('foo', undefined);
|
res.setHeader('foo', undefined);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
assert.ok(e instanceof Error);
|
assert.ok(e instanceof Error);
|
||||||
assert.equal(e.message, '`value` required in setHeader("foo", value).');
|
assert.equal(e.message, '"value" required in setHeader("foo", value)');
|
||||||
threw = true;
|
threw = true;
|
||||||
}
|
}
|
||||||
assert.ok(threw, 'Undefined value should throw');
|
assert.ok(threw, 'Undefined value should throw');
|
||||||
|
@ -38,55 +38,55 @@ server.listen(tcpPort, 'localhost', function() {
|
|||||||
|
|
||||||
fail({
|
fail({
|
||||||
port: true
|
port: true
|
||||||
}, TypeError, 'port should be a number or string: true');
|
}, TypeError, '"port" option should be a number or string: true');
|
||||||
|
|
||||||
fail({
|
fail({
|
||||||
port: false
|
port: false
|
||||||
}, TypeError, 'port should be a number or string: false');
|
}, TypeError, '"port" option should be a number or string: false');
|
||||||
|
|
||||||
fail({
|
fail({
|
||||||
port: []
|
port: []
|
||||||
}, TypeError, 'port should be a number or string: ');
|
}, TypeError, '"port" option should be a number or string: ');
|
||||||
|
|
||||||
fail({
|
fail({
|
||||||
port: {}
|
port: {}
|
||||||
}, TypeError, 'port should be a number or string: [object Object]');
|
}, TypeError, '"port" option should be a number or string: [object Object]');
|
||||||
|
|
||||||
fail({
|
fail({
|
||||||
port: null
|
port: null
|
||||||
}, TypeError, 'port should be a number or string: null');
|
}, TypeError, '"port" option should be a number or string: null');
|
||||||
|
|
||||||
fail({
|
fail({
|
||||||
port: ''
|
port: ''
|
||||||
}, RangeError, 'port should be >= 0 and < 65536: ');
|
}, RangeError, '"port" option should be >= 0 and < 65536: ');
|
||||||
|
|
||||||
fail({
|
fail({
|
||||||
port: ' '
|
port: ' '
|
||||||
}, RangeError, 'port should be >= 0 and < 65536: ');
|
}, RangeError, '"port" option should be >= 0 and < 65536: ');
|
||||||
|
|
||||||
fail({
|
fail({
|
||||||
port: '0x'
|
port: '0x'
|
||||||
}, RangeError, 'port should be >= 0 and < 65536: 0x');
|
}, RangeError, '"port" option should be >= 0 and < 65536: 0x');
|
||||||
|
|
||||||
fail({
|
fail({
|
||||||
port: '-0x1'
|
port: '-0x1'
|
||||||
}, RangeError, 'port should be >= 0 and < 65536: -0x1');
|
}, RangeError, '"port" option should be >= 0 and < 65536: -0x1');
|
||||||
|
|
||||||
fail({
|
fail({
|
||||||
port: NaN
|
port: NaN
|
||||||
}, RangeError, 'port should be >= 0 and < 65536: NaN');
|
}, RangeError, '"port" option should be >= 0 and < 65536: NaN');
|
||||||
|
|
||||||
fail({
|
fail({
|
||||||
port: Infinity
|
port: Infinity
|
||||||
}, RangeError, 'port should be >= 0 and < 65536: Infinity');
|
}, RangeError, '"port" option should be >= 0 and < 65536: Infinity');
|
||||||
|
|
||||||
fail({
|
fail({
|
||||||
port: -1
|
port: -1
|
||||||
}, RangeError, 'port should be >= 0 and < 65536: -1');
|
}, RangeError, '"port" option should be >= 0 and < 65536: -1');
|
||||||
|
|
||||||
fail({
|
fail({
|
||||||
port: 65536
|
port: 65536
|
||||||
}, RangeError, 'port should be >= 0 and < 65536: 65536');
|
}, RangeError, '"port" option should be >= 0 and < 65536: 65536');
|
||||||
});
|
});
|
||||||
|
|
||||||
// Try connecting to random ports, but do so once the server is closed
|
// Try connecting to random ports, but do so once the server is closed
|
||||||
|
@ -17,7 +17,7 @@ net.Server().listen({ port: '' + common.PORT }, close);
|
|||||||
'-Infinity' ].forEach(function(port) {
|
'-Infinity' ].forEach(function(port) {
|
||||||
assert.throws(function() {
|
assert.throws(function() {
|
||||||
net.Server().listen({ port: port }, assert.fail);
|
net.Server().listen({ port: port }, assert.fail);
|
||||||
}, /port should be >= 0 and < 65536/i);
|
}, /"port" option should be >= 0 and < 65536/i);
|
||||||
});
|
});
|
||||||
|
|
||||||
[null, true, false].forEach(function(port) {
|
[null, true, false].forEach(function(port) {
|
||||||
|
@ -56,17 +56,17 @@ var errors = [
|
|||||||
{method: 'parse', input: [],
|
{method: 'parse', input: [],
|
||||||
message: /Path must be a string. Received undefined/},
|
message: /Path must be a string. Received undefined/},
|
||||||
{method: 'format', input: [null],
|
{method: 'format', input: [null],
|
||||||
message: /Parameter 'pathObject' must be an object, not/},
|
message: /Parameter "pathObject" must be an object, not/},
|
||||||
{method: 'format', input: [''],
|
{method: 'format', input: [''],
|
||||||
message: /Parameter 'pathObject' must be an object, not string/},
|
message: /Parameter "pathObject" must be an object, not string/},
|
||||||
{method: 'format', input: [true],
|
{method: 'format', input: [true],
|
||||||
message: /Parameter 'pathObject' must be an object, not boolean/},
|
message: /Parameter "pathObject" must be an object, not boolean/},
|
||||||
{method: 'format', input: [1],
|
{method: 'format', input: [1],
|
||||||
message: /Parameter 'pathObject' must be an object, not number/},
|
message: /Parameter "pathObject" must be an object, not number/},
|
||||||
{method: 'format', input: [{root: true}],
|
{method: 'format', input: [{root: true}],
|
||||||
message: /'pathObject.root' must be a string or undefined, not boolean/},
|
message: /"pathObject\.root" must be a string or undefined, not boolean/},
|
||||||
{method: 'format', input: [{root: 12}],
|
{method: 'format', input: [{root: 12}],
|
||||||
message: /'pathObject.root' must be a string or undefined, not number/},
|
message: /"pathObject\.root" must be a string or undefined, not number/},
|
||||||
];
|
];
|
||||||
|
|
||||||
checkParseFormat(path.win32, winPaths);
|
checkParseFormat(path.win32, winPaths);
|
||||||
|
@ -222,7 +222,7 @@ function isWarned(emitter) {
|
|||||||
});
|
});
|
||||||
}, function(err) {
|
}, function(err) {
|
||||||
if (err instanceof TypeError) {
|
if (err instanceof TypeError) {
|
||||||
if (/Argument \'completer\' must be a function/.test(err)) {
|
if (/Argument "completer" must be a function/.test(err)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -380,4 +380,3 @@ function isWarned(emitter) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -20,4 +20,4 @@ const buf = new Buffer(kStringMaxLength + 1);
|
|||||||
|
|
||||||
assert.throws(function() {
|
assert.throws(function() {
|
||||||
buf.toString('ascii');
|
buf.toString('ascii');
|
||||||
}, /toString failed/);
|
}, /"toString\(\)" failed/);
|
||||||
|
@ -20,4 +20,4 @@ const buf = new Buffer(kStringMaxLength + 1);
|
|||||||
|
|
||||||
assert.throws(function() {
|
assert.throws(function() {
|
||||||
buf.toString('base64');
|
buf.toString('base64');
|
||||||
}, /toString failed/);
|
}, /"toString\(\)" failed/);
|
||||||
|
@ -20,7 +20,7 @@ const buf = new Buffer(kStringMaxLength + 1);
|
|||||||
|
|
||||||
assert.throws(function() {
|
assert.throws(function() {
|
||||||
buf.toString('binary');
|
buf.toString('binary');
|
||||||
}, /toString failed/);
|
}, /"toString\(\)" failed/);
|
||||||
|
|
||||||
var maxString = buf.toString('binary', 1);
|
var maxString = buf.toString('binary', 1);
|
||||||
assert.equal(maxString.length, kStringMaxLength);
|
assert.equal(maxString.length, kStringMaxLength);
|
||||||
|
@ -20,4 +20,4 @@ const buf = new Buffer(kStringMaxLength + 1);
|
|||||||
|
|
||||||
assert.throws(function() {
|
assert.throws(function() {
|
||||||
buf.toString('hex');
|
buf.toString('hex');
|
||||||
}, /toString failed/);
|
}, /"toString\(\)" failed/);
|
||||||
|
@ -20,8 +20,8 @@ const buf = new Buffer(kStringMaxLength + 1);
|
|||||||
|
|
||||||
assert.throws(function() {
|
assert.throws(function() {
|
||||||
buf.toString();
|
buf.toString();
|
||||||
}, /toString failed|Invalid array buffer length/);
|
}, /"toString\(\)" failed|Invalid array buffer length/);
|
||||||
|
|
||||||
assert.throws(function() {
|
assert.throws(function() {
|
||||||
buf.toString('utf8');
|
buf.toString('utf8');
|
||||||
}, /toString failed/);
|
}, /"toString\(\)" failed/);
|
||||||
|
@ -20,4 +20,4 @@ const buf0 = new Buffer(kStringMaxLength * 2 + 2);
|
|||||||
|
|
||||||
assert.throws(function() {
|
assert.throws(function() {
|
||||||
buf0.toString('utf16le');
|
buf0.toString('utf16le');
|
||||||
}, /toString failed/);
|
}, /"toString\(\)" failed/);
|
||||||
|
@ -131,10 +131,10 @@ function testUint(clazz) {
|
|||||||
const errmsg = `byteLength: ${i}`;
|
const errmsg = `byteLength: ${i}`;
|
||||||
ASSERT.throws(function() {
|
ASSERT.throws(function() {
|
||||||
data.writeUIntBE(val, 0, i);
|
data.writeUIntBE(val, 0, i);
|
||||||
}, /value is out of bounds/, errmsg);
|
}, /"value" argument is out of bounds/, errmsg);
|
||||||
ASSERT.throws(function() {
|
ASSERT.throws(function() {
|
||||||
data.writeUIntLE(val, 0, i);
|
data.writeUIntLE(val, 0, i);
|
||||||
}, /value is out of bounds/, errmsg);
|
}, /"value" argument is out of bounds/, errmsg);
|
||||||
val *= 0x100;
|
val *= 0x100;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user