/assert

Simplest assert package for Go

Primary LanguageGoApache License 2.0Apache-2.0

assert

  1. Simplest assertions for your Go test.
  2. Test failure also outputs assertion context.

Example:

import (
	"github.com/xli/assert"
	"testing"
)
func TestHelloWorld(t *testing.T) {
	assert.Equal(t, "hello", "world")
}

Output:

--- FAIL: TestHelloWorld (0.00s)
	assert.go:112: expected 'hello', but was 'world'
		x_test.go:9:
		  
		  func TestHelloWorld(t *testing.T) {
		=>	assert.Equal(t, "hello", "world")
		  }

More examples

License: Apache License v2