/assert

An assert function for Go that works like the one in C.

Primary LanguageGoMIT LicenseMIT

Assert

GoDoc

This package provides an assert function for Go. It's designed to work like assert in C.

Example

package my_test

import "github.com/tidwall/assert"

func TestMyThing(t *testing.T) {
    assert.Assert("hello" == "jello")
}

This will print the following message and abort the program.

Assertion failed: ("hello" == "jello"), function TestMyThing, file my_test.go, line 6.