From af56a93a8072bd57ea04d5024ed5a249949b4755 Mon Sep 17 00:00:00 2001 From: Bernerd Schaefer Date: Mon, 6 May 2013 11:13:44 +0200 Subject: [PATCH] Rename test helper files to helpers_test.go This ensures that these files are properly included only in testing. [Fixes #10] --- ...helpers_for_testing.go => helpers_test.go} | 15 +++++++++++ prometheus/test_helper.go | 26 ------------------- 2 files changed, 15 insertions(+), 26 deletions(-) rename prometheus/{helpers_for_testing.go => helpers_test.go} (70%) delete mode 100644 prometheus/test_helper.go diff --git a/prometheus/helpers_for_testing.go b/prometheus/helpers_test.go similarity index 70% rename from prometheus/helpers_for_testing.go rename to prometheus/helpers_test.go index 76dd5df..39d7d63 100644 --- a/prometheus/helpers_for_testing.go +++ b/prometheus/helpers_test.go @@ -38,3 +38,18 @@ func isNaN(obtained interface{}) (result bool) { return false } + +type valueEqualsChecker struct { + *CheckerInfo +} + +var ValueEquals Checker = &valueEqualsChecker{ + &CheckerInfo{Name: "IsValue", Params: []string{"obtained", "expected"}}, +} + +func (checker *valueEqualsChecker) Check(params []interface{}, names []string) (result bool, error string) { + actual := params[0].(*item).Value + expected := params[1] + + return actual == expected, "" +} diff --git a/prometheus/test_helper.go b/prometheus/test_helper.go deleted file mode 100644 index b5bd488..0000000 --- a/prometheus/test_helper.go +++ /dev/null @@ -1,26 +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 - -import ( - . "github.com/matttproud/gocheck" -) - -type valueEqualsChecker struct { - *CheckerInfo -} - -var ValueEquals Checker = &valueEqualsChecker{ - &CheckerInfo{Name: "IsValue", Params: []string{"obtained", "expected"}}, -} - -func (checker *valueEqualsChecker) Check(params []interface{}, names []string) (result bool, error string) { - actual := params[0].(*item).Value - expected := params[1] - - return actual == expected, "" -}