https://github.com/corebreaker/texit
You could use os.Exit() in Go tests
https://github.com/corebreaker/texit
go golang testing testing-tools
Last synced: 11 months ago
JSON representation
You could use os.Exit() in Go tests
- Host: GitHub
- URL: https://github.com/corebreaker/texit
- Owner: corebreaker
- License: gpl-3.0
- Created: 2016-11-17T17:35:27.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2019-05-15T05:34:38.000Z (about 7 years ago)
- Last Synced: 2025-02-14T16:54:34.786Z (over 1 year ago)
- Topics: go, golang, testing, testing-tools
- Language: Go
- Size: 60.5 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# texit
[](https://goreportcard.com/report/github.com/corebreaker/texit)
[](https://travis-ci.com/corebreaker/texit)
[](https://coveralls.io/github/corebreaker/texit)
[](https://godoc.org/github.com/corebreaker/texit)
[](https://github.com/corebreaker/texit/blob/master/LICENSE)
[](https://github.com/corebreaker/texit/releases)
Yes, you can use os.Exit() in Go tests.
Inspired by https://talks.golang.org/2014/testing.slide#23
## Example in a testing function
```golang
import (
"os"
"github.com/corebreaker/texit"
)
func TestWithExitDirectCall(t *testing.T) {
stdout, stderr, status, err := DoTestWithExit(func() {
// Something to do
os.Exit(0)
})
// …
}
```