https://github.com/brian14708/testexec
Run subprocess tests for Go.
https://github.com/brian14708/testexec
go golang testing
Last synced: 3 months ago
JSON representation
Run subprocess tests for Go.
- Host: GitHub
- URL: https://github.com/brian14708/testexec
- Owner: brian14708
- License: mit
- Created: 2022-01-13T10:59:03.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-03-26T14:45:18.000Z (4 months ago)
- Last Synced: 2025-03-26T15:44:29.377Z (4 months ago)
- Topics: go, golang, testing
- Language: Go
- Homepage:
- Size: 115 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# testexec
[](https://goreportcard.com/report/github.com/brian14708/testexec)
[](https://pkg.go.dev/github.com/brian14708/testexec)Run subprocess tests for Go.
## How to use
Setup code:
```go
func TestMain(m *testing.M) {
testexec.Main(m)
}
```Add subprocess program:
```go
var flagProgram = testexec.NewProgram(func(t *testexec.T, in int, out *int) {
var f = flag.Int("data", 1, "")
flag.Parse()
*out = in + *f
})
```Add test:
```go
func TestFlag(t *testing.T) {
var i int
testexec.Run(t, flagProgram, 12, &i, "--data=123")
assert.Equal(t, 135, i)
}
```