Skip to content

skhome/assertg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AssertG - Fluent Assertions for Go

CI

Go package to provide an intuitive set of strongly typed assertions for use in unit testing.

Inspiration and Goals

AssertG takes inspiration from AssertJ (an assertion library for Java) and Testify (a toolkit with common assertions for Go).

The assert package

Example:

import (
  "testing"
  "github.com/skhome/assertg/assert"
)

func TestSomething(t *testing.T) {
  assert.ThatString(t, "foobar").
    IsNotEmpty().
    StartsWith("foo").
    EndsWith("bar")

  assert.ThatSlice(t, []int{2, 4, 6}).
    HasSize(3).
    HasAllMatch(func(num int) bool { return num % 2 == 0 })
}

About

Assertion package for go

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published