assert.go 402 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
package assert

import "testing"

func Nil(err error, t *testing.T, msgs ...string) {
	if err != nil {
		t.Fatal(msgs, "error:", err)
	}
}

func True(v bool, t *testing.T, msgs ...string) {
	if !v {
		t.Fatal(msgs)
	}
}

Brian Tiger Chow's avatar
Brian Tiger Chow committed
17 18 19 20
func False(v bool, t *testing.T, msgs ...string) {
	True(!v, t, msgs...)
}

21 22 23 24 25
func Err(err error, t *testing.T, msgs ...string) {
	if err == nil {
		t.Fatal(msgs, "error:", err)
	}
}