Remove test.TB and use testing.TB, now that we depend on Go 1.3

Change-Id: Ie7c2e021a95705d2fe8379bdbb43c24fd0714836
This commit is contained in:
Brad Fitzpatrick 2014-08-25 16:43:34 -07:00
parent 1d95b1133b
commit 2d03daa802
3 changed files with 8 additions and 26 deletions

View File

@ -49,13 +49,13 @@ func (i indexType) String() string {
}
type queryTest struct {
t test.TB
t testing.TB
id *indextest.IndexDeps
Handler func() *Handler
}
func querySetup(t test.TB) (*indextest.IndexDeps, *Handler) {
func querySetup(t testing.TB) (*indextest.IndexDeps, *Handler) {
idx := index.NewMemoryIndex() // string key-value pairs in memory, as if they were on disk
id := indextest.NewIndexDeps(idx)
id.Fataler = t
@ -63,11 +63,11 @@ func querySetup(t test.TB) (*indextest.IndexDeps, *Handler) {
return id, h
}
func testQuery(t test.TB, fn func(*queryTest)) {
func testQuery(t testing.TB, fn func(*queryTest)) {
testQueryTypes(t, allIndexTypes, fn)
}
func testQueryTypes(t test.TB, types []indexType, fn func(*queryTest)) {
func testQueryTypes(t testing.TB, types []indexType, fn func(*queryTest)) {
defer test.TLog(t)()
for _, it := range types {
if *queryType == "" || *queryType == it.String() {
@ -77,7 +77,7 @@ func testQueryTypes(t test.TB, types []indexType, fn func(*queryTest)) {
}
}
func testQueryType(t test.TB, fn func(*queryTest), itype indexType) {
func testQueryType(t testing.TB, fn func(*queryTest), itype indexType) {
defer index.SetVerboseCorpusLogging(true)
index.SetVerboseCorpusLogging(false)

View File

@ -34,27 +34,9 @@ func BrokenTest(t *testing.T) {
}
}
// TB is a copy of Go 1.2's testing.TB.
type TB interface {
Error(args ...interface{})
Errorf(format string, args ...interface{})
Fail()
FailNow()
Failed() bool
Fatal(args ...interface{})
Fatalf(format string, args ...interface{})
Log(args ...interface{})
Logf(format string, args ...interface{})
Skip(args ...interface{})
SkipNow()
Skipf(format string, args ...interface{})
Skipped() bool
}
// TLog changes the log package's output to log to t and returns a function
// to reset it back to stderr.
func TLog(t TB) func() {
// TODO(bradfitz): once we rely on Go 1.2, change this to take a testing.TB.
func TLog(t testing.TB) func() {
log.SetOutput(&twriter{t: t})
return func() {
log.SetOutput(os.Stderr)
@ -66,7 +48,7 @@ func TLog(t TB) func() {
// method calls and Write calls:
// "Each logging operation makes a single call to the Writer's Write method"
type twriter struct {
t TB
t testing.TB
buf bytes.Buffer
}

View File

@ -28,7 +28,7 @@ import (
var _ index.Interface = (*FakeIndex)(nil)
type tbLogger struct {
TB
testing.TB
log []string
}