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 (
"encoding/json"
"testing"
"github.com/prometheus/client_golang/test"
)
func testCounter(t tester) {
func testCounter(t test.Tester) {
type input struct {
steps []func(g Counter)
}

View File

@ -9,9 +9,11 @@ package prometheus
import (
"encoding/json"
"testing"
"github.com/prometheus/client_golang/test"
)
func testGauge(t tester) {
func testGauge(t test.Tester) {
type input struct {
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"
"github.com/prometheus/client_golang/model"
"github.com/prometheus/client_golang/test"
)
func testRegister(t tester) {
func testRegister(t test.Tester) {
var oldState = struct {
abortOnMisuse bool
debugRegistration bool
@ -205,7 +206,7 @@ func (r *fakeResponseWriter) Write(d []byte) (l int, err error) {
func (r *fakeResponseWriter) WriteHeader(c int) {
}
func testHandler(t tester) {
func testHandler(t test.Tester) {
metric := NewCounter()
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 {
headers map[string]string
body []byte
@ -569,7 +570,7 @@ func BenchmarkDecorateWriter(b *testing.B) {
}
}
func testDumpToWriter(t tester) {
func testDumpToWriter(t test.Tester) {
type input struct {
metrics map[string]Metric
}

View File

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

View File

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