Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/brian14708/testexec
Run subprocess tests for Go.
https://github.com/brian14708/testexec
go golang testing
Last synced: 26 days 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 (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-12-06T14:14:43.000Z (about 1 month ago)
- Last Synced: 2024-12-06T15:26:38.079Z (about 1 month ago)
- Topics: go, golang, testing
- Language: Go
- Homepage:
- Size: 97.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# testexec
[![Go Report Card](https://goreportcard.com/badge/github.com/brian14708/testexec)](https://goreportcard.com/report/github.com/brian14708/testexec)
[![Go Reference](https://pkg.go.dev/badge/github.com/brian14708/testexec.svg)](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)
}
```