Remove the one duplication of the Tester interface.

Change-Id: Ie17ec3393a7e12e0f27e51b4060aa478a172f612
This commit is contained in:
Bjoern Rabenstein 2014-04-25 12:32:35 +02:00
parent e5dc0421cd
commit 00816363e4
6 changed files with 15 additions and 21 deletions

View File

@ -9,9 +9,11 @@ package prometheus
import ( import (
"encoding/json" "encoding/json"
"testing" "testing"
"github.com/prometheus/client_golang/test"
) )
func testCounter(t tester) { func testCounter(t test.Tester) {
type input struct { type input struct {
steps []func(g Counter) steps []func(g Counter)
} }

View File

@ -9,9 +9,11 @@ package prometheus
import ( import (
"encoding/json" "encoding/json"
"testing" "testing"
"github.com/prometheus/client_golang/test"
) )
func testGauge(t tester) { func testGauge(t test.Tester) {
type input struct { type input struct {
steps []func(g Gauge) steps []func(g Gauge)
} }

View File

@ -1,14 +0,0 @@
// Copyright (c) 2013, Prometheus Team
// All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package prometheus
type tester interface {
Error(args ...interface{})
Errorf(format string, args ...interface{})
Fatal(args ...interface{})
Fatalf(format string, args ...interface{})
}

View File

@ -20,9 +20,10 @@ import (
"code.google.com/p/goprotobuf/proto" "code.google.com/p/goprotobuf/proto"
"github.com/prometheus/client_golang/model" "github.com/prometheus/client_golang/model"
"github.com/prometheus/client_golang/test"
) )
func testRegister(t tester) { func testRegister(t test.Tester) {
var oldState = struct { var oldState = struct {
abortOnMisuse bool abortOnMisuse bool
debugRegistration bool debugRegistration bool
@ -205,7 +206,7 @@ func (r *fakeResponseWriter) Write(d []byte) (l int, err error) {
func (r *fakeResponseWriter) WriteHeader(c int) { func (r *fakeResponseWriter) WriteHeader(c int) {
} }
func testHandler(t tester) { func testHandler(t test.Tester) {
metric := NewCounter() metric := NewCounter()
metric.Increment(map[string]string{"labelname": "val1"}) metric.Increment(map[string]string{"labelname": "val1"})
@ -484,7 +485,7 @@ func BenchmarkHandler(b *testing.B) {
} }
} }
func testDecorateWriter(t tester) { func testDecorateWriter(t test.Tester) {
type input struct { type input struct {
headers map[string]string headers map[string]string
body []byte body []byte
@ -569,7 +570,7 @@ func BenchmarkDecorateWriter(b *testing.B) {
} }
} }
func testDumpToWriter(t tester) { func testDumpToWriter(t test.Tester) {
type input struct { type input struct {
metrics map[string]Metric metrics map[string]Metric
} }

View File

@ -9,9 +9,11 @@ package prometheus
import ( import (
"encoding/json" "encoding/json"
"testing" "testing"
"github.com/prometheus/client_golang/test"
) )
func testUntyped(t tester) { func testUntyped(t test.Tester) {
type input struct { type input struct {
steps []func(g Untyped) steps []func(g Untyped)
} }

View File

@ -14,6 +14,7 @@
// Package test provides common test helpers to the client library. // Package test provides common test helpers to the client library.
package test package test
// Tester is an interface implemented by both, testing.T and testing.B.
type Tester interface { type Tester interface {
Error(args ...interface{}) Error(args ...interface{})
Errorf(format string, args ...interface{}) Errorf(format string, args ...interface{})