// Test code
func Example_stubTimeWithConstant() {
	stubs := gostub.StubFunc(&timeNow, time.Date(2015, 07, 2, 0, 0, 0, 0, time.UTC))
	defer stubs.Reset()

	fmt.Println("Day:", GetDay())
	// Output:
	// Day: 2
}
Example #2
0
func ExampleStubFunc() {
	var osHostname = os.Hostname

	defer gostub.StubFunc(&osHostname, "fakehost", nil).Reset()
	host, err := osHostname()

	fmt.Println("Host:", host, "err:", err)
	// Output:
	// Host: fakehost err: <nil>
}