diff --git a/test/apply_private_method_test.go b/test/apply_private_method_test.go index aee21d5..3771de0 100644 --- a/test/apply_private_method_test.go +++ b/test/apply_private_method_test.go @@ -9,9 +9,9 @@ import ( . "github.com/smartystreets/goconvey/convey" ) -func TestApplyPrivate4PointerMethod(t *testing.T) { - Convey("TestApplyPrivate4PointerMethod", t, func() { - Convey("patch private method in the different package", func() { +func TestApplyPrivateMethod(t *testing.T) { + Convey("TestApplyPrivateMethod", t, func() { + Convey("patch private pointer method in the different package", func() { f := new(fake.PrivateMethodStruct) var s *fake.PrivateMethodStruct patches := ApplyPrivateMethod(reflect.TypeOf(s), "ok", func(_ *fake.PrivateMethodStruct) bool { @@ -21,13 +21,8 @@ func TestApplyPrivate4PointerMethod(t *testing.T) { result := f.Happy() So(result, ShouldEqual, "unhappy") }) - }) - -} -func TestApplyPrivate4ValueMethod(t *testing.T) { - Convey("TestApplyPrivate4ValueMethod", t, func() { - Convey("patch private method in the different package", func() { + Convey("patch private value method in the different package", func() { s := fake.PrivateMethodStruct{} patches := ApplyPrivateMethod(reflect.TypeOf(s), "haveEaten", func(_ fake.PrivateMethodStruct) bool { return false @@ -37,4 +32,6 @@ func TestApplyPrivate4ValueMethod(t *testing.T) { So(result, ShouldEqual, "I am hungry") }) }) + } + diff --git a/test/fake/fake.go b/test/fake/fake.go index 4ab8160..2c817e0 100644 --- a/test/fake/fake.go +++ b/test/fake/fake.go @@ -143,7 +143,7 @@ func (this *PrivateMethodStruct) Happy() string { } func (this PrivateMethodStruct) haveEaten() bool { - return true + return this != PrivateMethodStruct{} } func (this PrivateMethodStruct) AreYouHungry() string {