From 48c3240580014f9718a308321d6009094b0a8f0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Thu, 21 Dec 2017 12:08:31 -0800 Subject: [PATCH] Add test/harness file for isConstructor.js --- test/harness/isConstructor.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 test/harness/isConstructor.js diff --git a/test/harness/isConstructor.js b/test/harness/isConstructor.js new file mode 100644 index 0000000000..cc3a134997 --- /dev/null +++ b/test/harness/isConstructor.js @@ -0,0 +1,31 @@ +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Including isConstructor.js will expose one function: + + isConstructor + +includes: [isConstructor.js] +---*/ + +assert.sameValue(typeof isConstructor, "function"); + +assert.sameValue(isConstructor(), false); +assert.sameValue(isConstructor(undefined), false); +assert.sameValue(isConstructor(null), false); +assert.sameValue(isConstructor(123), false); +assert.sameValue(isConstructor(true), false); +assert.sameValue(isConstructor(false), false); +assert.sameValue(isConstructor("string"), false); + +assert.sameValue(isConstructor({}), false); +assert.sameValue(isConstructor([]), false); + +assert.sameValue(isConstructor(function(){}), true); +assert.sameValue(isConstructor(function*(){}), false); +assert.sameValue(isConstructor(() => {}), false); + +assert.sameValue(isConstructor(Array), true); +assert.sameValue(isConstructor(Array.prototype.map), false);