/mint

The very minimum assertion for Golang testing framework.

Primary LanguageGoMIT LicenseMIT

mint

Go codecov Go Report Card GoDoc GitHub tag (latest SemVer) FOSSA Status

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)
}

features

  • Simple syntax
  • Loosely coupled
  • Plain implementation

tests

go test ./...

use cases

Projects bellow use mint

License

FOSSA Status