Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/futile/go-lil-t

Little testing-helpers for go
https://github.com/futile/go-lil-t

Last synced: 12 days ago
JSON representation

Little testing-helpers for go

Awesome Lists containing this project

README

        

go-lil-t
========

I wrote these two little helpers, `If` and `IfNot`, to replace testing code such as:

```go
if result == nil {
t.Errorf("error")
}
```

with the much shorter:

```go
If(result == nil).Errorf("error")
```

which is much more readable. Also it helps to remove clutter from tests.

Example:
---------

```go
package example

import (
"testing"

"github.com/futile/go-lil-t"
)

func TestMyStuff(t *testing.T) {
If, IfNot := lilt.New(t)

If(false).Errorf("critical bug")

IfNot(true).Errorf("another critical bug")
}
```