Browse Source

test: improve regexps for error checking

test/parallel/test-catpto-random.js contains an object called
errorMesssage that contains regular expressions.They are only partially
matching regular expressions. Make them match the entire error message.

PR-URL: https://github.com/nodejs/node/pull/14271
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
v6
xinglong.wangwxl 8 years ago
committed by Rich Trott
parent
commit
2bbeec73af
  1. 12
      test/parallel/test-crypto-random.js

12
test/parallel/test-crypto-random.js

@ -140,12 +140,12 @@ const expectedErrorRegexp = /^TypeError: size must be a number >= 0$/;
new Uint8Array(new Array(10).fill(0))
];
const errMessages = {
offsetNotNumber: /offset must be a number/,
offsetOutOfRange: /offset out of range/,
offsetNotUInt32: /offset must be a uint32/,
sizeNotNumber: /size must be a number/,
sizeNotUInt32: /size must be a uint32/,
bufferTooSmall: /buffer too small/,
offsetNotNumber: /^TypeError: offset must be a number$/,
offsetOutOfRange: /^RangeError: offset out of range$/,
offsetNotUInt32: /^TypeError: offset must be a uint32$/,
sizeNotNumber: /^TypeError: size must be a number$/,
sizeNotUInt32: /^TypeError: size must be a uint32$/,
bufferTooSmall: /^RangeError: buffer too small$/,
};
for (const buf of bufs) {

Loading…
Cancel
Save