I've compiled an outline of Requirements to Consider for Go 2 Error Handling
<https://gist.github.com/networkimprov/961c9caa2631ad3b95413f7d44a2c98a>.
Recently I was asked about support for a test harness in functions that
contain error handlers; my document doesn't address this. My first guess is
that the tooling could generate a function to mirror the one being tested,
which takes a slice argument with a handler input (or function to call) for
each handler invocation site in the function:
func f(i int) { // function to test
op hname = x(i)
handle hname T { ... }
}
func f_errors(i int, e [1]interface{}) { // generated for go-test
op hname = e[0].(T) // or e[0].(func(int)T)(i)
handle hname T { ... }
}
I'd love to hear other ideas about triggering error handlers from a test
harness.
Note, these examples assume named handlers and other requirements that
place the handler body after its invocations. They're analogous to:
func f(i int) {
handle hname { ... }
check x(i)
}
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.