main
Last change
on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
696 bytes
|
Line | |
---|
1 | 'use strict';
|
---|
2 |
|
---|
3 | var test = require('tape');
|
---|
4 | var inspect = require('object-inspect');
|
---|
5 | var forEach = require('for-each');
|
---|
6 |
|
---|
7 | var isWeakRef = require('..');
|
---|
8 |
|
---|
9 | test('isWeakRef', function (t) {
|
---|
10 | t.equal(typeof isWeakRef, 'function', 'is a function');
|
---|
11 |
|
---|
12 | var nonWeakRefs = [undefined, null, true, false, 42, 0, Infinity, NaN, /a/g, function () {}, {}, []];
|
---|
13 | forEach(nonWeakRefs, function (nonWeakRef) {
|
---|
14 | t.equal(isWeakRef(nonWeakRef), false, inspect(nonWeakRef) + ' is not a WeakRef');
|
---|
15 | });
|
---|
16 |
|
---|
17 | t.test('actual WeakRefs', { skip: typeof WeakRef === 'undefined' }, function (st) {
|
---|
18 | var ref = new WeakRef({});
|
---|
19 |
|
---|
20 | st.equal(isWeakRef(ref), true, inspect(ref) + ' is a WeakRef');
|
---|
21 |
|
---|
22 | st.end();
|
---|
23 | });
|
---|
24 |
|
---|
25 | t.end();
|
---|
26 | });
|
---|
Note:
See
TracBrowser
for help on using the repository browser.