Skip to content

Commit

Permalink
test: improve regexps for error checking
Browse files Browse the repository at this point in the history
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: #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>
  • Loading branch information
hacke2 authored and addaleax committed Jul 18, 2017
1 parent 337a865 commit f5e8342
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions test/parallel/test-crypto-random.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit f5e8342

Please sign in to comment.