assert

package module
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2024 License: GPL-3.0 Imports: 2 Imported by: 0

README

testingassert

Simple package providing Assert functions for Golang testing

go get github.com/BatteredBunny/testingassert

Usage

func BasicTest(t *testing.T) {
    assert.TestState = t
    assert.HideSuccess = false

	assert.Equals("123", "1" + "2" + "3")
    assert.NotEquals(123, 5+3, "math operation returned wrong answer")

    a := 1 == 1
    assert.Assert(a, "function shouldn't return false!")
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HideSuccess = false

toggles if it should announce succeeding cases

View Source
var TestState *testing.T

the testing function state

Functions

func Assert

func Assert(val bool, failReason string)

Assert makes sure value is true, exits with custom error message

func Equals

func Equals(a, b any, customErrorMessage ...string)

Equals makes sure values are equal

func NotEquals

func NotEquals(a, b any, customErrorMessage ...string)

NotEquals makes sure values arent equal

Types

This section is empty.

Jump to

Keyboard shortcuts

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