The very minimum assertion for 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)
}
- Simple syntax
- Loosely coupled
- Plain implementation
go test ./...
Projects bellow use mint