Go单测
import (
"fmt"
"github.com/prashantv/gostub"
)
func main() {
var test1mock = test1
gostub.StubFunc(&test1mock, "test2")
test1mock()
}
func test1() {
fmt.Println("test1")
}
func test2() {
fmt.Println("test2")
}
import (
"fmt"
"github.com/prashantv/gostub"
)
func main() {
var test1mock = test1
gostub.StubFunc(&test1mock, "test2")
test1mock()
}
func test1() {
fmt.Println("test1")
}
func test2() {
fmt.Println("test2")
}