react / react-0.13.3 / examples / basic-commonjs / node_modules / browserify / node_modules / deep-equal / test / cmp.js
80728 viewsvar test = require('tape');1var equal = require('../');2var isArguments = require('../lib/is_arguments.js');3var objectKeys = require('../lib/keys.js');45test('equal', function (t) {6t.ok(equal(7{ a : [ 2, 3 ], b : [ 4 ] },8{ a : [ 2, 3 ], b : [ 4 ] }9));10t.end();11});1213test('not equal', function (t) {14t.notOk(equal(15{ x : 5, y : [6] },16{ x : 5, y : 6 }17));18t.end();19});2021test('nested nulls', function (t) {22t.ok(equal([ null, null, null ], [ null, null, null ]));23t.end();24});2526test('strict equal', function (t) {27t.notOk(equal(28[ { a: 3 }, { b: 4 } ],29[ { a: '3' }, { b: '4' } ],30{ strict: true }31));32t.end();33});3435test('non-objects', function (t) {36t.ok(equal(3, 3));37t.ok(equal('beep', 'beep'));38t.ok(equal('3', 3));39t.notOk(equal('3', 3, { strict: true }));40t.notOk(equal('3', [3]));41t.end();42});4344test('arguments class', function (t) {45t.ok(equal(46(function(){return arguments})(1,2,3),47(function(){return arguments})(1,2,3),48"compares arguments"49));50t.notOk(equal(51(function(){return arguments})(1,2,3),52[1,2,3],53"differenciates array and arguments"54));55t.end();56});5758test('test the arguments shim', function (t) {59t.ok(isArguments.supported((function(){return arguments})()));60t.notOk(isArguments.supported([1,2,3]));6162t.ok(isArguments.unsupported((function(){return arguments})()));63t.notOk(isArguments.unsupported([1,2,3]));6465t.end();66});6768test('test the keys shim', function (t) {69t.deepEqual(objectKeys.shim({ a: 1, b : 2 }), [ 'a', 'b' ]);70t.end();71});7273test('dates', function (t) {74var d0 = new Date(1387585278000);75var d1 = new Date('Fri Dec 20 2013 16:21:18 GMT-0800 (PST)');76t.ok(equal(d0, d1));77t.end();78});7980test('buffers', function (t) {81t.ok(equal(Buffer('xyz'), Buffer('xyz')));82t.end();83});8485test('booleans and arrays', function (t) {86t.notOk(equal(true, []));87t.end();88})899091