Skip to content

Commit 92ea411

Browse files
author
Michael Hendricks
authored
Merge pull request #5 from wking/wrap-failing-test
test/failing: Wrap failing tests in another harness
2 parents 2dfd665 + 80022f6 commit 92ea411

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

util/tap/test/failing/main.go

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,25 @@
11
package main
22

3-
import "github.com/mndrix/tap-go"
3+
import (
4+
"bytes"
5+
6+
"github.com/mndrix/tap-go"
7+
)
48

59
func main() {
6-
t := tap.New()
7-
t.Header(2)
8-
t.Ok(false, "first test")
9-
t.Fail("second test")
10+
t1 := tap.New()
11+
t1.Header(2)
12+
13+
buf := new(bytes.Buffer)
14+
t2 := tap.New()
15+
t2.Writer = buf
16+
t2.Header(2)
17+
18+
buf.Reset()
19+
t2.Ok(false, "first test")
20+
t1.Ok(buf.String() == "not ok 1 - first test\n", "Ok(false, ...) produces appropriate output")
21+
22+
buf.Reset()
23+
t2.Fail("second test")
24+
t1.Ok(buf.String() == "not ok 2 - second test\n", "Fail(...) produces appropriate output")
1025
}

0 commit comments

Comments
 (0)