| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184 |
- 'use strict';
- var tape = require('../');
- var tap = require('tap');
- var concat = require('concat-stream');
- var stripFullStack = require('./common').stripFullStack;
- tap.test('numerics', function (tt) {
- tt.plan(1);
- var test = tape.createHarness();
- test.createStream().pipe(concat(function (body) {
- tt.same(stripFullStack(body.toString('utf8')), [
- 'TAP version 13',
- '# numeric strings',
- 'not ok 1 number equal to string',
- ' ---',
- ' operator: equal',
- ' expected: \'3\'',
- ' actual: 3',
- ' at: Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)',
- ' stack: |-',
- ' Error: number equal to string',
- ' [... stack stripped ...]',
- ' at Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)',
- ' [... stack stripped ...]',
- ' ...',
- 'not ok 2 string equal to number',
- ' ---',
- ' operator: equal',
- ' expected: 3',
- ' actual: \'3\'',
- ' at: Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)',
- ' stack: |-',
- ' Error: string equal to number',
- ' [... stack stripped ...]',
- ' at Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)',
- ' [... stack stripped ...]',
- ' ...',
- 'ok 3 number notEqual to string',
- 'ok 4 string notEqual to number',
- 'ok 5 number looseEqual to string',
- 'ok 6 string looseEqual to number',
- 'not ok 7 number notLooseEqual to string',
- ' ---',
- ' operator: notDeepLooseEqual',
- ' expected: \'3\'',
- ' actual: 3',
- ' at: Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)',
- ' stack: |-',
- ' Error: number notLooseEqual to string',
- ' [... stack stripped ...]',
- ' at Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)',
- ' [... stack stripped ...]',
- ' ...',
- 'not ok 8 string notLooseEqual to number',
- ' ---',
- ' operator: notDeepLooseEqual',
- ' expected: 3',
- ' actual: \'3\'',
- ' at: Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)',
- ' stack: |-',
- ' Error: string notLooseEqual to number',
- ' [... stack stripped ...]',
- ' at Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)',
- ' [... stack stripped ...]',
- ' ...',
- 'not ok 9 number strictEqual to string',
- ' ---',
- ' operator: equal',
- ' expected: \'3\'',
- ' actual: 3',
- ' at: Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)',
- ' stack: |-',
- ' Error: number strictEqual to string',
- ' [... stack stripped ...]',
- ' at Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)',
- ' [... stack stripped ...]',
- ' ...',
- 'not ok 10 string strictEqual to number',
- ' ---',
- ' operator: equal',
- ' expected: 3',
- ' actual: \'3\'',
- ' at: Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)',
- ' stack: |-',
- ' Error: string strictEqual to number',
- ' [... stack stripped ...]',
- ' at Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)',
- ' [... stack stripped ...]',
- ' ...',
- 'ok 11 number notStrictEqual to string',
- 'ok 12 string notStrictEqual to number',
- 'ok 13 number deepLooseEqual to string',
- 'ok 14 string deepLooseEqual to number',
- 'not ok 15 number notDeepLooseEqual to string',
- ' ---',
- ' operator: notDeepLooseEqual',
- ' expected: \'3\'',
- ' actual: 3',
- ' at: Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)',
- ' stack: |-',
- ' Error: number notDeepLooseEqual to string',
- ' [... stack stripped ...]',
- ' at Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)',
- ' [... stack stripped ...]',
- ' ...',
- 'not ok 16 string notDeepLooseEqual to number',
- ' ---',
- ' operator: notDeepLooseEqual',
- ' expected: 3',
- ' actual: \'3\'',
- ' at: Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)',
- ' stack: |-',
- ' Error: string notDeepLooseEqual to number',
- ' [... stack stripped ...]',
- ' at Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)',
- ' [... stack stripped ...]',
- ' ...',
- 'not ok 17 number deepEqual to string',
- ' ---',
- ' operator: deepEqual',
- ' expected: \'3\'',
- ' actual: 3',
- ' at: Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)',
- ' stack: |-',
- ' Error: number deepEqual to string',
- ' [... stack stripped ...]',
- ' at Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)',
- ' [... stack stripped ...]',
- ' ...',
- 'not ok 18 string deepEqual to number',
- ' ---',
- ' operator: deepEqual',
- ' expected: 3',
- ' actual: \'3\'',
- ' at: Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)',
- ' stack: |-',
- ' Error: string deepEqual to number',
- ' [... stack stripped ...]',
- ' at Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)',
- ' [... stack stripped ...]',
- ' ...',
- 'ok 19 number notDeepEqual to string',
- 'ok 20 string notDeepEqual to number',
- '',
- '1..20',
- '# tests 20',
- '# pass 10',
- '# fail 10',
- ''
- ]);
- }));
- test('numeric strings', function (t) {
- t.equal(3, '3', 'number equal to string');
- t.equal('3', 3, 'string equal to number');
- t.notEqual(3, '3', 'number notEqual to string');
- t.notEqual('3', 3, 'string notEqual to number');
- t.looseEqual(3, '3', 'number looseEqual to string');
- t.looseEqual('3', 3, 'string looseEqual to number');
- t.notLooseEqual(3, '3', 'number notLooseEqual to string');
- t.notLooseEqual('3', 3, 'string notLooseEqual to number');
- t.strictEqual(3, '3', 'number strictEqual to string');
- t.strictEqual('3', 3, 'string strictEqual to number');
- t.notStrictEqual(3, '3', 'number notStrictEqual to string');
- t.notStrictEqual('3', 3, 'string notStrictEqual to number');
- t.deepLooseEqual(3, '3', 'number deepLooseEqual to string');
- t.deepLooseEqual('3', 3, 'string deepLooseEqual to number');
- t.notDeepLooseEqual(3, '3', 'number notDeepLooseEqual to string');
- t.notDeepLooseEqual('3', 3, 'string notDeepLooseEqual to number');
- t.deepEqual(3, '3', 'number deepEqual to string');
- t.deepEqual('3', 3, 'string deepEqual to number');
- t.notDeepEqual(3, '3', 'number notDeepEqual to string');
- t.notDeepEqual('3', 3, 'string notDeepEqual to number');
- t.end();
- });
- });
|