Skip to content
Go package for simple assertions
Go Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
vendor
.gitignore
.travis.yml
CHANGELOG.md
LICENSE
README.md
assert.go
assert_test.go
example_test.go
go.mod
go.sum
onchange.sh
qa_test.go

README.md

Build Status codecov

asserter - Go package oneline assertions

Quick start

go get github.com/gregoryv/asserter

In your tests

func Test_something(t *testing.T) {
   assert := asserter.New(t)
   got, err := something()
   assert(err == nil).Fatal(err)
   assert(got == exp).Errorf("%v, expected %v", got, exp)
   // or the shorter version when checking got vs. expected
   assert().Equals(got, exp)
   // and with optional case message
   assert().Equals(got, exp, "with no arguments")
   
   assert().Contains(got, "text")
   assert().Contains(got, 1)


   // Check readers content 
   resp, err := http.Get("http://example.com")
   assert(err == nil).Fatal(err)
   assert().Contains(resp.Body, "<title>")
}
You can’t perform that action at this time.