exam
is a small set of convenience functions designed to help
examine and assert values when writing test cases.
go get github.com/lcaballero/exam
n := 0
IsZero(t, n)
n := 1
IsEqInt(t, n, 1)
n := 2
GreaterThan(t, n, 1)
n := 3
IsTrue(t, n == 3)
n := 4
IsFalse(t, n == 3)
a := []byte{ 'a', 'b', 'c' }
b := []byte("abc")
IsEqBytes(t, a, b)
a := []byte{ 'a', 'b', 'c' }
b := []byte("abc")
IsEqByte(t, a[1], b[1])
type mystruct struct {}
my := &mystruct{}
IsNotNil(t, my)
var my *mystruct
IsNil(t, my)
willPanic := func() {
panic("panicking... now...")
}
ShouldPanic(t, willPanic)
dontPanic := func() {
// panicking... now...
}
ShouldNotPanic(t, dontPanic)
The use and distribution terms for this software are covered by the EPL-1, which can be found in the file ‘license’ at the root of this distribution. By using this software in any fashion, you are agreeing to be bound by the terms of this license. You must not remove this notice, or any other, from this software.