Categorygithub.com/kkyr/assert
modulepackage
0.2.1
Repository: https://github.com/kkyr/assert.git
Documentation: pkg.go.dev

# README

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

# Functions

New returns a new instance of Assert that reports any assertion failures to tb.

# Structs

Assert is a type that can make assertions.