gohamcrest is Hamcrest-style matchers for Golang testing designed for easy to write test case.
Simple, readable and humanized, also easy to extended.
Help you become an excellent Golang Software Engineer is my believe.
Install Go Env Getting Started .Once finished,then enjoy yourself.
gopm get github.com/tevid/gohamcrest -v -g
Or
go get -u github.com/tevid/gohamcrest
PS: Prefer Golang 1.6+
- Assert.List
- Assert.Object
- Assert.String
More feature please respect.
- Assert equal
func TestEqual(t *testing.T) {
Assert(t,2,Equal(2))
Assert(t,"joe",Equal("joe"))
}
- Assert not equal
func TestNotEqual(t *testing.T) {
Assert(t,2,NotEqual(3))
Assert(t,"joe",NotEqual("joe1"))
}
or
func TestNotEqual(t *testing.T) {
Assert(t,2,Not(Equal(3)))
Assert(t,"joe",Not(Equal("joe1")))
}
More usage,check test case please.More info check Wiki .
If you think the tool is good or have any problems,must let me know, contact me by email when feel free or create a issue.
- Source Code: https://github.com/tevid/gohamcrest/
- Issue Tracker: https://github.com/tevid/gohamcrest/issues
The project is licensed under the Apache 2 license.