assert

package module
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2023 License: GPL-3.0 Imports: 2 Imported by: 0

README

testingassert

Simple package providing Assert functions for Golang testing

go get github.com/ayes-web/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 added in v0.2.0

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

Equals makes sure values are equal

func NotEquals added in v0.2.0

func NotEquals(a any, 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