proxy.golang.org : github.com/xdg-go/testy
Package testy is an extensible facade around Go's core testing library. Go's core testing package doesn't let you refactor repetitive tests without reporting errors from the wrong place in the code. Testy implements a facade around the testing package and hijacks its logging features. This means: * You can report test errors at any level up the call stack. * You can label all errors in a scope to disambiguate repetitive tests. The downside is an extra level of log message nesting (which your editor's quickfix window should ignore, anyway). It gives a few convenient helper functions for common cases and makes it easy to implement your own. The following example shows how to set up testy and use test helpers. In particular, note the use of 'defer' and a closure to schedule testy to output the log at the end of the function's execution. Each error will be reported at the calling line. Calls to 'Equal' and 'Unequal' will return diagnostic details. Here is how some of the output would look in Vim's quickfix window: You can use the 'Uplevel' and 'Label' methods to return new facades, which you can use to implement custom helpers in various ways: The example above would return errors to a quickfix window like this:
Registry
-
Source
- Documentation
- JSON
- codemeta.json
purl: pkg:golang/github.com/xdg-go/testy
License: Apache-2.0
Latest release: almost 8 years ago
First release: almost 8 years ago
Namespace: github.com/xdg-go
Stars: 74 on GitHub
Forks: 1 on GitHub
See more repository details: repos.ecosyste.ms
Last synced: 14 days ago