Skip to content

Commit

Permalink
test: test internal/util/types in vm
Browse files Browse the repository at this point in the history
PR-URL: #25056
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
ZYSzys authored and MylesBorins committed Dec 25, 2018
1 parent a5bccc2 commit 5eb5d1d
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions test/parallel/test-util-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,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')));
}

{
Expand Down

0 comments on commit 5eb5d1d

Please sign in to comment.