1 var test = require('tape');
2 var equal = require('../');
3 var isArguments = require('../lib/is_arguments.js');
4 var objectKeys = require('../lib/keys.js');
6 test('equal', function (t) {
8 { a : [ 2, 3 ], b : [ 4 ] },
9 { a : [ 2, 3 ], b : [ 4 ] }
14 test('not equal', function (t) {
22 test('nested nulls', function (t) {
23 t.ok(equal([ null, null, null ], [ null, null, null ]));
27 test('strict equal', function (t) {
29 [ { a: 3 }, { b: 4 } ],
30 [ { a: '3' }, { b: '4' } ],
36 test('non-objects', function (t) {
38 t.ok(equal('beep', 'beep'));
40 t.notOk(equal('3', 3, { strict: true }));
41 t.notOk(equal('3', [3]));
45 test('arguments class', function (t) {
47 (function(){return arguments})(1,2,3),
48 (function(){return arguments})(1,2,3),
52 (function(){return arguments})(1,2,3),
54 "differenciates array and arguments"
59 test('test the arguments shim', function (t) {
60 t.ok(isArguments.supported((function(){return arguments})()));
61 t.notOk(isArguments.supported([1,2,3]));
63 t.ok(isArguments.unsupported((function(){return arguments})()));
64 t.notOk(isArguments.unsupported([1,2,3]));
69 test('test the keys shim', function (t) {
70 t.deepEqual(objectKeys.shim({ a: 1, b : 2 }), [ 'a', 'b' ]);
74 test('dates', function (t) {
75 var d0 = new Date(1387585278000);
76 var d1 = new Date('Fri Dec 20 2013 16:21:18 GMT-0800 (PST)');
81 test('buffers', function (t) {
82 t.ok(equal(Buffer('xyz'), Buffer('xyz')));
86 test('booleans and arrays', function (t) {
87 t.notOk(equal(true, []));
91 test('null == undefined', function (t) {
92 t.ok(equal(null, undefined))
93 t.notOk(equal(null, undefined, { strict: true }))