types: add CloseFunc and update TB's docs

Change-Id: I49dcbc5c48754e5d5074dfbbb278fb969b35aee5
This commit is contained in:
Brad Fitzpatrick 2015-04-13 19:49:08 +02:00
parent 58035c4c1b
commit 85380193cf
1 changed files with 7 additions and 1 deletions

View File

@ -236,7 +236,8 @@ func (c *onceCloser) Close() error {
return err return err
} }
// TB is a copy of Go 1.2's testing.TB. // TB is a copy of testing.TB so things can take a TB without linking
// in the testing package (which defines its own flags, etc).
type TB interface { type TB interface {
Error(args ...interface{}) Error(args ...interface{})
Errorf(format string, args ...interface{}) Errorf(format string, args ...interface{})
@ -252,3 +253,8 @@ type TB interface {
Skipf(format string, args ...interface{}) Skipf(format string, args ...interface{})
Skipped() bool Skipped() bool
} }
// CloseFunc implements io.Closer with a function.
type CloseFunc func() error
func (fn CloseFunc) Close() error { return fn() }