1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
package tmp
import (
"testing"
)
type UselessStruct struct {
ImportantField string
T *testing.T
}
var testFunc = func(t *testing.T, arg *string) {}
func assertEqual(t *testing.T, arg1, arg2 interface{}) {
if arg1 != arg2 {
t.Fail()
}
}
func TestSomethingImportant(t *testing.T) {
whatever := &UselessStruct{
T: t,
ImportantField: "SECRET_PASSWORD",
}
something := &UselessStruct{ImportantField: "string value"}
assertEqual(t, whatever.ImportantField, "SECRET_PASSWORD")
assertEqual(t, something.ImportantField, "string value")
var foo = func(t *testing.T) {}
foo(t)
strp := "something"
testFunc(t, &strp)
t.Fail()
}
func Test3Things(t *testing.T) {
if 3 != 3 {
t.Fail()
}
}
|