Browse Source

test: use regex error checks in test-util-format

Replace constructor with regular expression for second argument
to assert.throws() in test-util-format.

PR-URL: https://github.com/nodejs/node/pull/14299
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
v6.x
Superwoods 8 years ago
committed by Myles Borins
parent
commit
bbe328830f
No known key found for this signature in database GPG Key ID: 933B01F40B5CA946
  1. 2
      test/parallel/test-util-format.js

2
test/parallel/test-util-format.js

@ -25,7 +25,7 @@ assert.strictEqual(util.format('%s', symbol), 'Symbol(foo)');
assert.strictEqual(util.format('%j', symbol), 'undefined');
assert.throws(function() {
util.format('%d', symbol);
}, TypeError);
}, /^TypeError: Cannot convert a Symbol value to a number$/);
assert.strictEqual(util.format('%d', 42.0), '42');
assert.strictEqual(util.format('%d', 42), '42');

Loading…
Cancel
Save