diff --git a/pkg/search/query_test.go b/pkg/search/query_test.go index f27437549..f146ee670 100644 --- a/pkg/search/query_test.go +++ b/pkg/search/query_test.go @@ -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) diff --git a/pkg/test/test.go b/pkg/test/test.go index b4175b265..91fa53a8c 100644 --- a/pkg/test/test.go +++ b/pkg/test/test.go @@ -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 } diff --git a/pkg/test/test_test.go b/pkg/test/test_test.go index 5bd91df6d..a83c01ca2 100644 --- a/pkg/test/test_test.go +++ b/pkg/test/test_test.go @@ -28,7 +28,7 @@ import ( var _ index.Interface = (*FakeIndex)(nil) type tbLogger struct { - TB + testing.TB log []string }