gotestyourself / gotestyourself/gotest.tools
Proposal: changes for next major release (v4)
- Dominant language
- Go
- Stars
- 576
- Forks
- 54
- Avg merge
- 6d 3h
- Merged PRs (30d)
- 2
Description
With the opportunity to use generics to improve the `assert` package (#255), we may want to release a new major version. This issue is to discuss and track changes that would require a major version bump, so that we can include all of them when the time is right.
1. Change the signature of the `assert`, and `assert/cmp` functions to use generics instead of `any` as the argument types (#255)
2. Combine the `skip`, `env`, and `poll` packages into a single new package. These packages are very small, and combining them into a single package should make it easier to use `gotest.tools` by requiring fewer imports. I'm not sure what to name that package yet. They could be included as part of the `assert` package, but the names don't read as well.
3. Replace the `golden` package with a `GoldenFile(t, filename)` function in the `assert` package. #237 added support for golden-like behaviour using expected values stored in a Go variable. We should be able to do something similar:
```go
func GoldenFile(t TestingT, filename string) string { ... }
```
Similar to golden variables, when called with `-update`, `assert.Assert` should be able to detect that the expected argument is a `GoldenFile` and use the actual value to update the specified filename.
4. Maybe `icmd` could change to use `context.Context` to set the timeout instead of a `time.Duration` passed to `WaitOnCommand` ? Some way to pass a deadline/timeout using `context.Context` might be good.
Are there other breaking changes we should consider? Anything in `fs` that could change now that the stdlib has an `fs` package or because of generics?
Contributor guide
Assessment
This issue has not been assessed yet.