Skip to content

Commit

Permalink
move some more random output tests to fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Jan 25, 2017
1 parent 07f68dd commit f6023b1
Show file tree
Hide file tree
Showing 41 changed files with 266 additions and 102 deletions.
102 changes: 0 additions & 102 deletions test/test-test.js
Expand Up @@ -98,94 +98,6 @@ test('plan stuff', function (t) {
t.end()
})

test('do nothing after bailout', function (t) {
var tt = new Test({ buffered: false })
var out = ''
tt.on('data', function (c) {
out += c
})
tt.bailout('this is fine')
tt.plan(9999)
tt.test('nope', function (t) {
throw new Error('should not get here')
})
tt.throws(function () {}, 'did not throw')
tt.end()
tt.plan(100)
t.equal(out, 'TAP version 13\nBail out! # this is fine\n')
t.end()
})

test('subtest without arguments', function (t) {
var tt = new Test({ buffered: false })
var out = ''
tt.on('data', function (c) {
out += c
})
tt.test()
tt.end()

t.match(out, /^TAP version 13\nok 1 - \(unnamed test\) # TODO\n1\.\.1\n$/)

t.end()
})

test('subtest with only a name', function (t) {
var tt = new Test({ buffered: false })
var out = ''
tt.on('data', function (c) {
out += c
})
tt.test('name only')
tt.end()

t.match(out, /^TAP version 13\nok 1 - name only # TODO\n1\.\.1\n$/)

t.end()
})

test('subtest with only options', function (t) {
var tt = new Test({ buffered: false })
var out = ''
tt.on('data', function (c) {
out += c
})
tt.test({skip: true})
tt.end()

t.match(out, /^TAP version 13\nok 1 - \(unnamed test\) # SKIP\n1\.\.1\n$/)

t.end()
})

test('subtest with only a function', function (t) {
var tt = new Test({ buffered: false })
var out = ''
tt.on('data', function (c) {
out += c
})
tt.test(function (t){t.end()})
tt.end()

t.equal(out, 'TAP version 13\n# Subtest: (unnamed test)\n 1..0\nok 1 - (unnamed test)\n\n1..1\n');

t.end()
})

test('subtest with name and options', function (t) {
var tt = new Test({ buffered: false })
var out = ''
tt.on('data', function (c) {
out += c
})
tt.test('name', {skip: false})
tt.end()

t.match(out, /^TAP version 13\nok 1 - name # TODO\n1\.\.1\n$/)

t.end()
})

test('subtest with name and function', function (t) {
var tt = new Test({ buffered: false })
var out = ''
Expand All @@ -199,20 +111,6 @@ test('subtest with name and function', function (t) {
t.end()
})

test('subtest with options and function', function (t) {
var tt = new Test({ buffered: false })
var out = ''
tt.on('data', function (c) {
out += c
})
tt.test({skip: false}, function (t){t.end()})
tt.end()

t.equal(out, 'TAP version 13\n# Subtest: (unnamed test)\n 1..0\nok 1 - (unnamed test)\n\n1..1\n');

t.end()
})

test('invalid test arguments', function (t) {
t.throws(function () {
var tt = new Test({ buffered: false })
Expand Down
3 changes: 3 additions & 0 deletions test/test/bailout-with-stuff-after--bail--buffer.tap
@@ -0,0 +1,3 @@
TAP version 13
Bail out! # this is fine

3 changes: 3 additions & 0 deletions test/test/bailout-with-stuff-after--bail.tap
@@ -0,0 +1,3 @@
TAP version 13
Bail out! # this is fine

3 changes: 3 additions & 0 deletions test/test/bailout-with-stuff-after--buffer.tap
@@ -0,0 +1,3 @@
TAP version 13
Bail out! # this is fine

9 changes: 9 additions & 0 deletions test/test/bailout-with-stuff-after.js
@@ -0,0 +1,9 @@
var t = require('../..')
t.bailout('this is fine')
t.plan(9999)
t.test('nope', function (t) {
throw new Error('should not get here')
})
t.throws(function () {}, 'did not throw')
t.end()
t.plan(100)
3 changes: 3 additions & 0 deletions test/test/bailout-with-stuff-after.tap
@@ -0,0 +1,3 @@
TAP version 13
Bail out! # this is fine

9 changes: 9 additions & 0 deletions test/test/subtest-only-options--bail--buffer.tap
@@ -0,0 +1,9 @@
TAP version 13
ok 1 - (unnamed test) # SKIP
---
{"some":"diags"}
...

1..1
# skip: 1

9 changes: 9 additions & 0 deletions test/test/subtest-only-options--bail.tap
@@ -0,0 +1,9 @@
TAP version 13
ok 1 - (unnamed test) # SKIP
---
{"some":"diags"}
...

1..1
# skip: 1

9 changes: 9 additions & 0 deletions test/test/subtest-only-options--buffer.tap
@@ -0,0 +1,9 @@
TAP version 13
ok 1 - (unnamed test) # SKIP
---
{"some":"diags"}
...

1..1
# skip: 1

5 changes: 5 additions & 0 deletions test/test/subtest-only-options.js
@@ -0,0 +1,5 @@
var Test = require('../..').Test
var t = new Test()
t.pipe(process.stdout)
t.test({ skip: true, some: 'diags', diagnostic: true })
t.end()
9 changes: 9 additions & 0 deletions test/test/subtest-only-options.tap
@@ -0,0 +1,9 @@
TAP version 13
ok 1 - (unnamed test) # SKIP
---
{"some":"diags"}
...

1..1
# skip: 1

7 changes: 7 additions & 0 deletions test/test/subtest-with-name-and-function--bail--buffer.tap
@@ -0,0 +1,7 @@
TAP version 13
ok 1 - name {
1..0
}

1..1

7 changes: 7 additions & 0 deletions test/test/subtest-with-name-and-function--bail.tap
@@ -0,0 +1,7 @@
TAP version 13
# Subtest: name
1..0
ok 1 - name

1..1

7 changes: 7 additions & 0 deletions test/test/subtest-with-name-and-function--buffer.tap
@@ -0,0 +1,7 @@
TAP version 13
ok 1 - name {
1..0
}

1..1

5 changes: 5 additions & 0 deletions test/test/subtest-with-name-and-function.js
@@ -0,0 +1,5 @@
var Test = require('../..').Test
var t = new Test()
t.pipe(process.stdout)
t.test('name', function (t){t.end()})
t.end()
7 changes: 7 additions & 0 deletions test/test/subtest-with-name-and-function.tap
@@ -0,0 +1,7 @@
TAP version 13
# Subtest: name
1..0
ok 1 - name

1..1

9 changes: 9 additions & 0 deletions test/test/subtest-with-name-and-options--bail--buffer.tap
@@ -0,0 +1,9 @@
TAP version 13
ok 1 - name # SKIP
---
{"some":"diags"}
...

1..1
# skip: 1

9 changes: 9 additions & 0 deletions test/test/subtest-with-name-and-options--bail.tap
@@ -0,0 +1,9 @@
TAP version 13
ok 1 - name # SKIP
---
{"some":"diags"}
...

1..1
# skip: 1

9 changes: 9 additions & 0 deletions test/test/subtest-with-name-and-options--buffer.tap
@@ -0,0 +1,9 @@
TAP version 13
ok 1 - name # SKIP
---
{"some":"diags"}
...

1..1
# skip: 1

5 changes: 5 additions & 0 deletions test/test/subtest-with-name-and-options.js
@@ -0,0 +1,5 @@
var Test = require('../..').Test
var t = new Test()
t.pipe(process.stdout)
t.test('name', { skip: true, some: 'diags', diagnostic: true })
t.end()
9 changes: 9 additions & 0 deletions test/test/subtest-with-name-and-options.tap
@@ -0,0 +1,9 @@
TAP version 13
ok 1 - name # SKIP
---
{"some":"diags"}
...

1..1
# skip: 1

7 changes: 7 additions & 0 deletions test/test/subtest-with-only-a-function--bail--buffer.tap
@@ -0,0 +1,7 @@
TAP version 13
ok 1 - (unnamed test) {
1..0
}

1..1

7 changes: 7 additions & 0 deletions test/test/subtest-with-only-a-function--bail.tap
@@ -0,0 +1,7 @@
TAP version 13
# Subtest: (unnamed test)
1..0
ok 1 - (unnamed test)

1..1

7 changes: 7 additions & 0 deletions test/test/subtest-with-only-a-function--buffer.tap
@@ -0,0 +1,7 @@
TAP version 13
ok 1 - (unnamed test) {
1..0
}

1..1

5 changes: 5 additions & 0 deletions test/test/subtest-with-only-a-function.js
@@ -0,0 +1,5 @@
var Test = require('../..').Test
var t = new Test()
t.pipe(process.stdout)
t.test(function (t){t.end()})
t.end()
7 changes: 7 additions & 0 deletions test/test/subtest-with-only-a-function.tap
@@ -0,0 +1,7 @@
TAP version 13
# Subtest: (unnamed test)
1..0
ok 1 - (unnamed test)

1..1

5 changes: 5 additions & 0 deletions test/test/subtest-with-only-a-name--bail--buffer.tap
@@ -0,0 +1,5 @@
TAP version 13
ok 1 - name only # TODO
1..1
# todo: 1

5 changes: 5 additions & 0 deletions test/test/subtest-with-only-a-name--bail.tap
@@ -0,0 +1,5 @@
TAP version 13
ok 1 - name only # TODO
1..1
# todo: 1

5 changes: 5 additions & 0 deletions test/test/subtest-with-only-a-name--buffer.tap
@@ -0,0 +1,5 @@
TAP version 13
ok 1 - name only # TODO
1..1
# todo: 1

5 changes: 5 additions & 0 deletions test/test/subtest-with-only-a-name.js
@@ -0,0 +1,5 @@
var Test = require('../..').Test
var t = new Test()
t.pipe(process.stdout)
t.test('name only')
t.end()
5 changes: 5 additions & 0 deletions test/test/subtest-with-only-a-name.tap
@@ -0,0 +1,5 @@
TAP version 13
ok 1 - name only # TODO
1..1
# todo: 1

11 changes: 11 additions & 0 deletions test/test/subtest-with-options-and-function--bail--buffer.tap
@@ -0,0 +1,11 @@
TAP version 13
ok 1 - (unnamed test)
---
{"some":"diags"}
...
{
1..0
}

1..1

10 changes: 10 additions & 0 deletions test/test/subtest-with-options-and-function--bail.tap
@@ -0,0 +1,10 @@
TAP version 13
# Subtest: (unnamed test)
1..0
ok 1 - (unnamed test)
---
{"some":"diags"}
...

1..1

11 changes: 11 additions & 0 deletions test/test/subtest-with-options-and-function--buffer.tap
@@ -0,0 +1,11 @@
TAP version 13
ok 1 - (unnamed test)
---
{"some":"diags"}
...
{
1..0
}

1..1

5 changes: 5 additions & 0 deletions test/test/subtest-with-options-and-function.js
@@ -0,0 +1,5 @@
var Test = require('../..').Test
var t = new Test()
t.pipe(process.stdout)
t.test({ skip: false, some: 'diags', diagnostic: true }, function (t){t.end()})
t.end()
10 changes: 10 additions & 0 deletions test/test/subtest-with-options-and-function.tap
@@ -0,0 +1,10 @@
TAP version 13
# Subtest: (unnamed test)
1..0
ok 1 - (unnamed test)
---
{"some":"diags"}
...

1..1

5 changes: 5 additions & 0 deletions test/test/subtest-without-arguments--bail--buffer.tap
@@ -0,0 +1,5 @@
TAP version 13
ok 1 - (unnamed test) # TODO
1..1
# todo: 1

0 comments on commit f6023b1

Please sign in to comment.