Skip to content

Commit 7f9e3f3

Browse files
author
Dean Karn
authored
Merge pull request #9 from n0trace/v2-development
replace *testing.T to testing.TB
2 parents 6660f81 + 4504239 commit 7f9e3f3

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import (
3636
. "gopkg.in/bluesuncorp/assert.v1"
3737
)
3838

39-
func AssertCustomErrorHandler(t *testing.T, errs map[string]string, key, expected string) {
39+
func AssertCustomErrorHandler(t testing.TB, errs map[string]string, key, expected string) {
4040
val, ok := errs[key]
4141

4242
// using EqualSkip and NotEqualSkip as building blocks for my custom Assert function

assert.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,14 @@ CASE4:
6767
}
6868

6969
// Equal validates that val1 is equal to val2 and throws an error with line number
70-
func Equal(t *testing.T, val1, val2 interface{}) {
70+
func Equal(t testing.TB, val1, val2 interface{}) {
7171
EqualSkip(t, 2, val1, val2)
7272
}
7373

7474
// EqualSkip validates that val1 is equal to val2 and throws an error with line number
7575
// but the skip variable tells EqualSkip how far back on the stack to report the error.
7676
// This is a building block to creating your own more complex validation functions.
77-
func EqualSkip(t *testing.T, skip int, val1, val2 interface{}) {
77+
func EqualSkip(t testing.TB, skip int, val1, val2 interface{}) {
7878

7979
if !IsEqual(val1, val2) {
8080
_, file, line, _ := runtime.Caller(skip)
@@ -84,14 +84,14 @@ func EqualSkip(t *testing.T, skip int, val1, val2 interface{}) {
8484
}
8585

8686
// NotEqual validates that val1 is not equal val2 and throws an error with line number
87-
func NotEqual(t *testing.T, val1, val2 interface{}) {
87+
func NotEqual(t testing.TB, val1, val2 interface{}) {
8888
NotEqualSkip(t, 2, val1, val2)
8989
}
9090

9191
// NotEqualSkip validates that val1 is not equal to val2 and throws an error with line number
9292
// but the skip variable tells NotEqualSkip how far back on the stack to report the error.
9393
// This is a building block to creating your own more complex validation functions.
94-
func NotEqualSkip(t *testing.T, skip int, val1, val2 interface{}) {
94+
func NotEqualSkip(t testing.TB, skip int, val1, val2 interface{}) {
9595

9696
if IsEqual(val1, val2) {
9797
_, file, line, _ := runtime.Caller(skip)
@@ -101,14 +101,14 @@ func NotEqualSkip(t *testing.T, skip int, val1, val2 interface{}) {
101101
}
102102

103103
// PanicMatches validates that the panic output of running fn matches the supplied string
104-
func PanicMatches(t *testing.T, fn func(), matches string) {
104+
func PanicMatches(t testing.TB, fn func(), matches string) {
105105
PanicMatchesSkip(t, 2, fn, matches)
106106
}
107107

108108
// PanicMatchesSkip validates that the panic output of running fn matches the supplied string
109109
// but the skip variable tells PanicMatchesSkip how far back on the stack to report the error.
110110
// This is a building block to creating your own more complex validation functions.
111-
func PanicMatchesSkip(t *testing.T, skip int, fn func(), matches string) {
111+
func PanicMatchesSkip(t testing.TB, skip int, fn func(), matches string) {
112112

113113
_, file, line, _ := runtime.Caller(skip)
114114

assert_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
// go test -coverprofile cover.out && go tool cover -html=cover.out -o cover.html
1717
//
1818

19-
func MyCustomErrorHandler(t *testing.T, errs map[string]string, key, expected string) {
19+
func MyCustomErrorHandler(t testing.TB, errs map[string]string, key, expected string) {
2020
val, ok := errs[key]
2121
EqualSkip(t, 2, ok, true)
2222
NotEqualSkip(t, 2, val, nil)

doc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ validations.
1111
. "gopkg.in/bluesuncorp/assert.v1"
1212
)
1313
14-
func AssertCustomErrorHandler(t *testing.T, errs map[string]string, key, expected string) {
14+
func AssertCustomErrorHandler(t testing.TB, errs map[string]string, key, expected string) {
1515
val, ok := errs[key]
1616
1717
// using EqualSkip and NotEqualSkip as building blocks for my custom Assert function

0 commit comments

Comments
 (0)