From 078a2ba22fd64ba2492bfa12938c3496c6243c07 Mon Sep 17 00:00:00 2001 From: ZYSzys <17367077526@163.com> Date: Sat, 15 Dec 2018 16:15:40 +0800 Subject: [PATCH] test: test internal/util/types in vm MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/25056 Reviewed-By: Michaƫl Zasso Reviewed-By: Daijiro Wachi Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Luigi Pinca --- test/parallel/test-util-types.js | 34 ++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/test/parallel/test-util-types.js b/test/parallel/test-util-types.js index 2978cbf98deb0c..c07e9a9255ecfc 100644 --- a/test/parallel/test-util-types.js +++ b/test/parallel/test-util-types.js @@ -81,6 +81,40 @@ for (const [ value, _method ] of [ { assert(!types.isUint8Array({ [Symbol.toStringTag]: 'Uint8Array' })); assert(types.isUint8Array(vm.runInNewContext('new Uint8Array'))); + + assert(!types.isUint8ClampedArray({ + [Symbol.toStringTag]: 'Uint8ClampedArray' + })); + assert(types.isUint8ClampedArray( + vm.runInNewContext('new Uint8ClampedArray') + )); + + assert(!types.isUint16Array({ [Symbol.toStringTag]: 'Uint16Array' })); + assert(types.isUint16Array(vm.runInNewContext('new Uint16Array'))); + + assert(!types.isUint32Array({ [Symbol.toStringTag]: 'Uint32Array' })); + assert(types.isUint32Array(vm.runInNewContext('new Uint32Array'))); + + assert(!types.isInt8Array({ [Symbol.toStringTag]: 'Int8Array' })); + assert(types.isInt8Array(vm.runInNewContext('new Int8Array'))); + + assert(!types.isInt16Array({ [Symbol.toStringTag]: 'Int16Array' })); + assert(types.isInt16Array(vm.runInNewContext('new Int16Array'))); + + assert(!types.isInt32Array({ [Symbol.toStringTag]: 'Int32Array' })); + assert(types.isInt32Array(vm.runInNewContext('new Int32Array'))); + + assert(!types.isFloat32Array({ [Symbol.toStringTag]: 'Float32Array' })); + assert(types.isFloat32Array(vm.runInNewContext('new Float32Array'))); + + assert(!types.isFloat64Array({ [Symbol.toStringTag]: 'Float64Array' })); + assert(types.isFloat64Array(vm.runInNewContext('new Float64Array'))); + + assert(!types.isBigInt64Array({ [Symbol.toStringTag]: 'BigInt64Array' })); + assert(types.isBigInt64Array(vm.runInNewContext('new BigInt64Array'))); + + assert(!types.isBigUint64Array({ [Symbol.toStringTag]: 'BigUint64Array' })); + assert(types.isBigUint64Array(vm.runInNewContext('new BigUint64Array'))); } {