Last active
August 29, 2015 14:16
-
-
Save isaacs/ae5b6943df88ec3b9e3f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TAP version 13 | |
# nesting | |
1..2 | |
# first | |
1..2 | |
ok 1 - true is ok | |
ok 2 - doag is also okay | |
ok 1 - first | |
# second | |
ok 1 - but that is ok | |
ok 2 - this passes | |
ok 3 - nested ok | |
1..3 | |
ok 2 - second | |
ok 4 - nesting | |
ok 5 - this passes | |
ok 6 - this passes too | |
# async kid | |
1..2 | |
ok 1 - second timeout | |
ok 2 - first timeout | |
ok 7 - async kid | |
ok 8 - pass after async kid | |
1..8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ node test/test/ok.js | bin/parse.js | |
[ [ 'version', '13' ], | |
[ 'comment', '# nesting\n' ], | |
[ 'child', | |
[ [ 'plan', 2 ], | |
[ 'child', | |
[ [ 'plan', 2 ], | |
[ 'result', { id: 1, ok: true, name: 'true is ok' } ], | |
[ 'result', { id: 2, ok: true, name: 'doag is also okay' } ], | |
[ 'complete', { plan: 2, count: 2, pass: 2, ok: true } ] ] ], | |
[ 'result', { id: 1, ok: true, name: 'first' } ], | |
[ 'child', | |
[ [ 'result', { id: 1, ok: true, name: 'but that is ok' } ], | |
[ 'result', { id: 2, ok: true, name: 'this passes' } ], | |
[ 'result', { id: 3, ok: true, name: 'nested ok' } ], | |
[ 'plan', 3 ], | |
[ 'complete', { plan: 3, count: 3, pass: 3, ok: true } ] ] ], | |
[ 'result', { id: 2, ok: true, name: 'second' } ], | |
[ 'complete', { plan: 2, count: 2, pass: 2, ok: true } ] ] ], | |
[ 'comment', ' # first\n' ], | |
[ 'comment', ' # second\n' ], | |
[ 'result', { id: 4, ok: true, name: 'nesting' } ], | |
[ 'result', { id: 5, ok: true, name: 'this passes' } ], | |
[ 'comment', '# async kid\n' ], | |
[ 'result', { id: 6, ok: true, name: 'this passes too' } ], | |
[ 'child', | |
[ [ 'plan', 2 ], | |
[ 'result', { id: 1, ok: true, name: 'second timeout' } ], | |
[ 'result', { id: 2, ok: true, name: 'first timeout' } ], | |
[ 'complete', { plan: 2, count: 2, pass: 2, ok: true } ] ] ], | |
[ 'result', { id: 7, ok: true, name: 'async kid' } ], | |
[ 'result', { id: 8, ok: true, name: 'pass after async kid' } ], | |
[ 'plan', 8 ], | |
[ 'complete', { plan: 8, count: 5, pass: 5, ok: false } ] ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var t = require('../../lib/test.js')() | |
t.test('nesting', function (t) { | |
t.plan(2) | |
t.test('first', function (tt) { | |
tt.plan(2) | |
tt.ok(true, 'true is ok') | |
tt.assert('doeg', 'doag is also okay') | |
}) | |
t.test('second', function (tt) { | |
function foo() { | |
tt.ok('no plan', 'but that is ok') | |
tt.pass('this passes') | |
tt.equal(1, 1, 'nested ok') | |
tt.end() | |
} | |
function bar() { | |
return foo() | |
} | |
function baz() { | |
return bar() | |
} | |
baz() | |
}) | |
}) | |
t.pass('this passes') | |
t.pass('this passes too') | |
t.test('async kid', function (t) { | |
t.plan(2) | |
setTimeout(function () { | |
t.ok(true, 'first timeout', { foo: 'blz' }) | |
}, 50) | |
setTimeout(function () { | |
t.pass('second timeout') | |
}) | |
}) | |
t.pass('pass after async kid') | |
t.end() | |
t.pipe(process.stdout) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment