unkiwii / assert

A very simple package to compare test results in Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

unkiwii/assert

Go Reference Go Report Card

A very simple package to compare test results in Go

Very simple API

This package has only 5 functions:

  • FailOnError: fails the test if an error occurred
  • Nil: fails the test if the value isn't nil
  • Equals: fails the test if the values are no equal
  • IsError: fails the test if 2 errors are not equivalent
  • AsError: fails the test if 2 error types are not equivalent

Usage

With go modules just run:

$ go get github.com/unkiwii/assert

Import and use it:

package something_test

import "github.com/unkiwii/assert"

func TestSomething(t *testing.T) {
	// setup your test case
	want := "the result you want"

	// run your test case
	got, err := ...

	// check the results
	assert.Nil(t, err)
	assert.Equals(t, got, want)
}

Contributing

See CONTRIBUTING.md

License

This project is licensed under the terms of the MIT license

See LICENSE

About

A very simple package to compare test results in Go

License:MIT License


Languages

Language:Go 100.0%