main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
1.1 KB
|
Rev | Line | |
---|
[d565449] | 1 | 'use strict';
|
---|
| 2 |
|
---|
| 3 | var test = require('tape');
|
---|
| 4 | var debug = require('object-inspect');
|
---|
| 5 | var forEach = require('for-each');
|
---|
| 6 |
|
---|
| 7 | var isWeakSet = require('..');
|
---|
| 8 |
|
---|
| 9 | test('non-collections', function (t) {
|
---|
| 10 | forEach([
|
---|
| 11 | null,
|
---|
| 12 | undefined,
|
---|
| 13 | true,
|
---|
| 14 | false,
|
---|
| 15 | 42,
|
---|
| 16 | 0,
|
---|
| 17 | -0,
|
---|
| 18 | NaN,
|
---|
| 19 | Infinity,
|
---|
| 20 | '',
|
---|
| 21 | 'foo',
|
---|
| 22 | /a/g,
|
---|
| 23 | [],
|
---|
| 24 | {},
|
---|
| 25 | function () {}
|
---|
| 26 | ], function (nonCollection) {
|
---|
| 27 | t.equal(isWeakSet(nonCollection), false, debug(nonCollection) + ' is not a WeakSet');
|
---|
| 28 | });
|
---|
| 29 |
|
---|
| 30 | t.end();
|
---|
| 31 | });
|
---|
| 32 |
|
---|
| 33 | test('Maps', { skip: typeof Map !== 'function' }, function (t) {
|
---|
| 34 | var m = new Map();
|
---|
| 35 | t.equal(isWeakSet(m), false, debug(m) + ' is not a WeakSet');
|
---|
| 36 |
|
---|
| 37 | t.end();
|
---|
| 38 | });
|
---|
| 39 |
|
---|
| 40 | test('Sets', { skip: typeof Set !== 'function' }, function (t) {
|
---|
| 41 | var s = new Set();
|
---|
| 42 | t.equal(isWeakSet(s), false, debug(s) + ' is not a WeakSet');
|
---|
| 43 |
|
---|
| 44 | t.end();
|
---|
| 45 | });
|
---|
| 46 |
|
---|
| 47 | test('WeakMaps', { skip: typeof WeakMap !== 'function' }, function (t) {
|
---|
| 48 | var wm = new WeakMap();
|
---|
| 49 | t.equal(isWeakSet(wm), false, debug(wm) + ' is not a WeakSet');
|
---|
| 50 |
|
---|
| 51 | t.end();
|
---|
| 52 | });
|
---|
| 53 |
|
---|
| 54 | test('WeakSets', { skip: typeof WeakSet !== 'function' }, function (t) {
|
---|
| 55 | var ws = new WeakSet();
|
---|
| 56 | t.equal(isWeakSet(ws), true, debug(ws) + ' is a WeakSet');
|
---|
| 57 |
|
---|
| 58 | t.end();
|
---|
| 59 | });
|
---|
Note:
See
TracBrowser
for help on using the repository browser.