xli / assert

Simplest assert package for Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

Simplest assert package for Go

License:Apache License 2.0


Languages

Language:Go 100.0%