Skip to content

Commit

Permalink
refactor test and adapter arm64
Browse files Browse the repository at this point in the history
  • Loading branch information
agiledragon committed Oct 21, 2021
1 parent a0235aa commit bd851d7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
15 changes: 6 additions & 9 deletions test/apply_private_method_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand All @@ -37,4 +32,6 @@ func TestApplyPrivate4ValueMethod(t *testing.T) {
So(result, ShouldEqual, "I am hungry")
})
})

}

2 changes: 1 addition & 1 deletion test/fake/fake.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func (this *PrivateMethodStruct) Happy() string {
}

func (this PrivateMethodStruct) haveEaten() bool {
return true
return this != PrivateMethodStruct{}
}

func (this PrivateMethodStruct) AreYouHungry() string {
Expand Down

0 comments on commit bd851d7

Please sign in to comment.