assert

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 19, 2020 License: MPL-2.0 Imports: 5 Imported by: 0

README

Minimalistic assertion library

Installation

go get -u github.com/hooklift/assert

Usage
package blah

import (
	"testing"

	"github.com/hooklift/assert"
)

func TestSave(t *testing.T) {
	u := &Account{
		repo:     &RepoMock{},
		Email:    "camilo@hooklift.io",
		Password: "mypassword",
		Name:     "Camilo Aguilar",
	}

	err := u.Save()
	assert.Ok(t, err)
	assert.Cond(t, u.ID != "", "User ID should not be empty: %v", u)

	u2, err := Get(u.ID)
	assert.Ok(t, err)
	assert.Equals(t, u.ID, u2.ID)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cond

func Cond(tb testing.TB, condition bool, msg string, v ...interface{})

assert fails the test if the condition is false.

func Equals

func Equals(tb testing.TB, exp, act interface{})

equals fails the test if exp is not equal to act.

func Ok

func Ok(tb testing.TB, err error)

ok fails the test if an err is not nil.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL