github.com/kaiya/goutils@v1.0.1-0.20230226104005-4ae4a4dc3688/hotpatch/hotpatch_test.go (about)

     1  package hotpatch
     2  
     3  import "testing"
     4  
     5  func Test_Hotpatch(t *testing.T) {
     6  	patch := ApplyFunc(fakeFunc, func() string {
     7  		return "should invoke this"
     8  	})
     9  	defer patch.Reset()
    10  	output := fakeFunc()
    11  	t.Logf("got output: %s", output)
    12  }
    13  
    14  func fakeFunc() string {
    15  	return "fakeFunc"
    16  }