Example #1
0
// This fills in for the logging function. The test graph includes a pointer to a testing.T
// object, which is used by the mock logger. (These messages will only be visible if go test
// is running in verbose mode. See http://golang.org/pkg/testing/#T.Logf)
func MockLogger(s string, a ...interface{}) (int, error) {

	inj.Inject(func(t *testing.T) {
		t.Logf(s, a...)
	})

	return 0, nil
}
Example #2
0
File: main.go Project: kelyar/inj
func middleware(fn interface{}) func(http.ResponseWriter, *http.Request) {

	return func(w http.ResponseWriter, r *http.Request) {
		inj.Inject(fn, w, r)
	}
}