Skip to content

Commit c2e1191

Browse files
committed
Add Pass() and Fail()
These are sometimes helpful in complex tests.
1 parent a9c812c commit c2e1191

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

util/tap.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff 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.
8294
func (t *T) Check(function interface{}, description string) {

0 commit comments

Comments
 (0)