Skip to content

Commit

Permalink
test: add regression tests
Browse files Browse the repository at this point in the history
This makes sure util.isDate and util.isRegExp will not abort in case
more than one argument is passed to the utility function.

PR-URL: #19188
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
BridgeAR committed Mar 11, 2018
1 parent 9757906 commit 8181c60
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/parallel/test-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ assert.strictEqual(false, util.isArray(Object.create(Array.prototype)));

// isRegExp
assert.strictEqual(true, util.isRegExp(/regexp/));
assert.strictEqual(true, util.isRegExp(RegExp()));
assert.strictEqual(true, util.isRegExp(RegExp(), 'foo'));
assert.strictEqual(true, util.isRegExp(new RegExp()));
assert.strictEqual(true, util.isRegExp(context('RegExp')()));
assert.strictEqual(false, util.isRegExp({}));
Expand All @@ -52,7 +52,7 @@ assert.strictEqual(false, util.isRegExp(Object.create(RegExp.prototype)));

// isDate
assert.strictEqual(true, util.isDate(new Date()));
assert.strictEqual(true, util.isDate(new Date(0)));
assert.strictEqual(true, util.isDate(new Date(0), 'foo'));
assert.strictEqual(true, util.isDate(new (context('Date'))()));
assert.strictEqual(false, util.isDate(Date()));
assert.strictEqual(false, util.isDate({}));
Expand Down

0 comments on commit 8181c60

Please sign in to comment.