From 60692bb6e06680cabb4f603883d274d8339d09fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Thu, 21 Dec 2017 12:08:29 -0800 Subject: Move remaining testBuiltInObject callers to use normal assert calls --- harness/features.yml | 1 + harness/isConstructor.js | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 harness/isConstructor.js (limited to 'harness') diff --git a/harness/features.yml b/harness/features.yml index 177bec32b..d08adaf64 100644 --- a/harness/features.yml +++ b/harness/features.yml @@ -1,3 +1,4 @@ typeCoercion.js: [Symbol.toPrimitive, BigInt] testAtomics.js: [ArrayBuffer, Atomics, DataView, SharedArrayBuffer, arrow-function, let, for-of] testTypedArray.js: [TypedArray] +isConstructor.js: [Reflect.construct] diff --git a/harness/isConstructor.js b/harness/isConstructor.js new file mode 100644 index 000000000..bf7433219 --- /dev/null +++ b/harness/isConstructor.js @@ -0,0 +1,16 @@ +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: | + Test if a given function is a constructor function. +---*/ + +function isConstructor(f) { + try { + Reflect.construct(function(){}, [], f); + } catch (e) { + return false; + } + return true; +} -- cgit v1.2.1