An open API service providing package, version and dependency metadata of many open source software ecosystems and registries.

Top 7.2% on proxy.golang.org

proxy.golang.org : github.com/tvastar/tester

Package tester implements a test runner compatible with testing.T Usage: This package implements a subset of the testing.T type. In particular, it implements the testing.TB interface and also provides helpers to run subtests using tester.Run. The package is intended to help build test suites that can not only run with `go test` but can also be run to validate things in production code. The intention is to be able to write production validation code (which is meant to be compiled into command line tools or service binaries) in much the same way as regular tests. Individual tests can use t.Error, t.Errorf etc (as well as gotest.tools/v3/assert functions, for instance, or the stretchr/testify set of helpers). Unfortunately, indvidual tests written with the standard signature of `TestXYZ(t *testing.T)` cannot be used with tester.New() as the testing.T type is concrete and tester.New() does not return a type compatible with this.. Instead, the suggested approach is for test suites to be written against tester.T like so: And then, a TestAll function can be written that will work properly with testing.T: When tester.Run is used in a `go test` type situation, it simply maps it to t.Run. But when it is used with a `tester.New()` instance, it correctly creates a sub task using on that type. This allows tests written in the style of testing.T (but using the subset of methods in tester.T) to be executed either in a test environment (using testing.T) or in a production environment (using tester.New()). The main export of this package is the New() function.

Registry - Source - Documentation - JSON
purl: pkg:golang/github.com/tvastar/tester
License: MIT
Latest release: about 1 month ago
Namespace: github.com/tvastar
Stars: 0 on GitHub
Forks: 0 on GitHub
See more repository details: repos.ecosyste.ms
Last synced: about 1 month ago