Exemplo n.º 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
}
Exemplo n.º 2
0
Arquivo: main.go Projeto: kelyar/inj
func middleware(fn interface{}) func(http.ResponseWriter, *http.Request) {

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