File tree Expand file tree Collapse file tree 3 files changed +15
-2
lines changed Expand file tree Collapse file tree 3 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -77,6 +77,18 @@ func (t *T) Ok(test bool, description string) {
7777 t .nextTestNumber ++
7878}
7979
80+ // Fail indicates that a test has failed. This is typically only used when the
81+ // logic is too complex to fit naturally into an Ok() call.
82+ func (t * T ) Fail (description string ) {
83+ t .Ok (false , description )
84+ }
85+
86+ // Pass indicates that a test has passed. This is typically only used when the
87+ // logic is too complex to fit naturally into an Ok() call.
88+ func (t * T ) Pass (description string ) {
89+ t .Ok (true , description )
90+ }
91+
8092// Check runs randomized tests against a function just as "testing/quick.Check"
8193// does. Success or failure generate appropriate TAP output.
8294func (t * T ) Check (function interface {}, description string ) {
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import "github.com/mndrix/tap-go"
44
55func main () {
66 t := tap .New ()
7- t .Header (1 )
7+ t .Header (2 )
88 t .Ok (false , "first test" )
9+ t .Fail ("second test" )
910}
Original file line number Diff line number Diff line change @@ -6,5 +6,5 @@ func main() {
66 t := tap .New ()
77 t .Header (2 )
88 t .Ok (true , "first test" )
9- t .Ok ( true , "second test" )
9+ t .Pass ( "second test" )
1010}
You can’t perform that action at this time.
0 commit comments