Skip to content

Commit

Permalink
fix defer timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
samanhappy committed Aug 22, 2024
1 parent 88fa5c6 commit e0bc1ed
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions monkey/monkey_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ func TestPatch(t *testing.T) {
originalFunc := func() string { return "original" }
replacementFunc := func() string { return "replacement" }

patch := Patch(originalFunc, replacementFunc)
defer patch.Reset()
Patch(originalFunc, replacementFunc)

assert.Equal(t, "replacement", originalFunc())
}
Expand All @@ -52,7 +51,6 @@ func TestUnpatch(t *testing.T) {

func TestPatchInstanceMethod(t *testing.T) {
PatchInstanceMethod(reflect.TypeOf(&MyStruct{}), "Method", func(*MyStruct) string { return "replacement" })
defer UnpatchInstanceMethod(reflect.TypeOf(&MyStruct{}), "Method")

assert.Equal(t, "replacement", (&MyStruct{}).Method())
}
Expand Down

0 comments on commit e0bc1ed

Please sign in to comment.