From 8181c607e5cd96afc041636ceb37ff6758e8d470 Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Wed, 7 Mar 2018 00:07:46 +0100 Subject: [PATCH] test: add regression tests 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: https://github.com/nodejs/node/pull/19188 Reviewed-By: Colin Ihrig Reviewed-By: Evan Lucas Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Luigi Pinca --- test/parallel/test-util.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-util.js b/test/parallel/test-util.js index 10ad1db4eeb2ba..a60e0d5b53727e 100644 --- a/test/parallel/test-util.js +++ b/test/parallel/test-util.js @@ -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({})); @@ -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({}));