Skip to content
This repository has been archived by the owner on May 14, 2024. It is now read-only.
/ checkmate Public archive
forked from go-check/check

Poor testing for the Go language

License

Notifications You must be signed in to change notification settings

cilium/checkmate

 
 

Repository files navigation

Instructions

checkmate is meant to ease migrating off of gopkg.in/check.v1 and use the Go stdlib testing package instead. It achieves this by embedding a *testing.T in *check.C and ripping out the test runner code. This means that the following is now possible:

func myUsefulHelper(tb testing.TB, ...) {
    // ...
}

func (s *Suite) TestSomething(c *C) {
    myUsefulHelper(c, ...)
}

Use it as a global replacement:

$ go mod edit -replace=gopkg.in/check.v1=github.com/cilium/checkmate

Or replace imports manually:

import . "github.com/cilium/checkmate"
import check "github.com/cilium/checkmate"

Caveats

This library differs from upstream check in the following ways:

  • Run*() and TestingT() don't block until all tests have run
  • Run*() don't return Result anymore, due to the above
  • C.Succeed*() fails the test since there is no analog in *testing.T
  • RunConfig.KeepWorkDir is not supported
  • Any flags that are not benchmark related cause an error
  • The output format of check is not preserved

About

Poor testing for the Go language

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%