Skip to content

kkyr/assert

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

assert Semver Tag Go Report Coverage Status

assert is a Go library that helps you make assertions in tests, printing a human-readable report of the differences between two values in assertions that fail.

Installation

$ go get github.com/kkyr/assert@latest

Usage

package person_test

import (
    "testing"
    
    "github.com/kkyr/assert"
)

func TestPerson(t *testing.T) {
    assert := assert.New(t)

    want := []string{"John", "Jim"}
    got := []string{"John", "Joe"}

    assert.Field("Names").Equal(want, got)
    
    // Output:
    // --- FAIL: TestPerson (0.00s)
    //     person_test.go:15: Names: (-want, +got):
    //              []string{
    //                    "John", 
    //            -       "Jim", 
    //            +       "Joe",
    //              }
}

Documentation

GoDoc