https://github.com/otiai10/mint
The very minimum assertion for Golang testing framework.
https://github.com/otiai10/mint
assertion go testing
Last synced: about 1 year ago
JSON representation
The very minimum assertion for Golang testing framework.
- Host: GitHub
- URL: https://github.com/otiai10/mint
- Owner: otiai10
- License: mit
- Created: 2014-05-27T01:20:22.000Z (almost 12 years ago)
- Default Branch: main
- Last Pushed: 2023-07-02T21:21:52.000Z (almost 3 years ago)
- Last Synced: 2024-10-29T20:32:48.709Z (over 1 year ago)
- Topics: assertion, go, testing
- Language: Go
- Homepage: https://pkg.go.dev/github.com/otiai10/mint
- Size: 65.4 KB
- Stars: 34
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# mint
[](https://github.com/otiai10/mint/actions/workflows/go.yml)
[](https://codecov.io/gh/otiai10/mint)
[](https://goreportcard.com/report/github.com/otiai10/mint)
[](https://godoc.org/github.com/otiai10/mint)
[](https://pkg.go.dev/github.com/otiai10/mint)
[](https://app.fossa.com/projects/git%2Bgithub.com%2Fotiai10%2Fmint?ref=badge_shield)
The very minimum assertion for Go.
```go
package your_test
import (
"testing"
"pkg/your"
. "github.com/otiai10/mint"
)
func TestFoo(t *testing.T) {
foo := your.Foo()
Expect(t, foo).ToBe(1234)
Expect(t, foo).TypeOf("int")
Expect(t, foo).Not().ToBe(nil)
Expect(t, func() { yourFunc() }).Exit(1)
// If assertion failed, exit 1 with message.
Expect(t, foo).ToBe("foobarbuz")
// You can run assertions without os.Exit
res := Expect(t, foo).Dry().ToBe("bar")
// res.OK() == false
// You can omit repeated `t`.
m := mint.Blend(t)
m.Expect(foo).ToBe(1234)
}
```
# features
- Simple syntax
- Loosely coupled
- Plain implementation
# tests
```
go test ./...
```
# use cases
Projects bellow use `mint`
- [github.com/otiai10/gosseract](https://github.com/otiai10/gosseract/blob/master/all_test.go)
- [github.com/otiai10/marmoset](https://github.com/otiai10/marmoset/blob/master/all_test.go#L168-L190)
## License
[](https://app.fossa.com/projects/git%2Bgithub.com%2Fotiai10%2Fmint?ref=badge_large)