Skip to content

Commit

Permalink
Merge pull request opencontainers#5 from wking/wrap-failing-test
Browse files Browse the repository at this point in the history
test/failing: Wrap failing tests in another harness
  • Loading branch information
Michael Hendricks authored Jan 5, 2017
2 parents 2dfd665 + 80022f6 commit 92ea411
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions util/tap/test/failing/main.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
package main

import "github.com/mndrix/tap-go"
import (
"bytes"

"github.com/mndrix/tap-go"
)

func main() {
t := tap.New()
t.Header(2)
t.Ok(false, "first test")
t.Fail("second test")
t1 := tap.New()
t1.Header(2)

buf := new(bytes.Buffer)
t2 := tap.New()
t2.Writer = buf
t2.Header(2)

buf.Reset()
t2.Ok(false, "first test")
t1.Ok(buf.String() == "not ok 1 - first test\n", "Ok(false, ...) produces appropriate output")

buf.Reset()
t2.Fail("second test")
t1.Ok(buf.String() == "not ok 2 - second test\n", "Fail(...) produces appropriate output")
}

0 comments on commit 92ea411

Please sign in to comment.