Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bgpat/matrixtest
matrixtest is a Go testing package with matrixed testcases
https://github.com/bgpat/matrixtest
Last synced: about 2 months ago
JSON representation
matrixtest is a Go testing package with matrixed testcases
- Host: GitHub
- URL: https://github.com/bgpat/matrixtest
- Owner: bgpat
- License: mit
- Created: 2020-07-04T08:02:56.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-12-15T20:23:31.000Z (about 1 year ago)
- Last Synced: 2024-10-14T19:23:19.693Z (3 months ago)
- Language: Go
- Size: 4.88 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# matrixtest
Package matrixtest provides tools for testing with matrixed testcases.
## Installation
```bash
go get -u github.com/bgpat/matrixtest
```## Usage
```go
func Test(t *testing.T) {
type testcase struct {
Bool bool
Int int
String string
Pointer *struct{}
Slice []byte
}
testcases := map[string]interface{}{
"bool": testcase{Bool: true},
"int": testcase{Int: 1},
"string": testcase{String: "test"},
"pointer": testcase{Pointer: &struct{}{}},
"slice": testcase{Slice: []byte("test")},
}
matrixtest.Run(t, testcases, func(testcase interface{}) func(t *testing.T) {
return func(t *testing.T) {
t.Log(testcase)
}
})
}
```