testy

package module
v0.0.0-...-c017291 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2020 License: MIT Imports: 3 Imported by: 0

README

golang-testing-util-functions

Testing functions I use in my GO testing files

Usage: Add repo to your '_test.go' file(s):

import (
	"testing"

	tt "github.com/john2exonets/golang-testing-util-functions"
)

Then call the functions as needed.

tt.NotErr(t, err) -- Make sure there was no error returned.
tt.IsErr(t, err) -- Make sure an error was returned.
tt.Assert(t, a, b) -- Is 'a' equilivliant to 'b'. Works with any variable Type.
tt.AssertNot(t, a, b) -- Check to make sure 'a' is not equilivliant to 'b'. Works with any variable Type.
tt.Contains(t, a, b) -- Is 'a' a member of 'b'? Works with Strings and Slices.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Assert

func Assert(t *testing.T, a interface{}, b interface{})

Assert if the two values are equal, if not error out

func AssertNot

func AssertNot(t *testing.T, a interface{}, b interface{})

AssertNot - that the two values are NOT equal

func Contains

func Contains(t *testing.T, target interface{}, list interface{})

Contains - does the list contain the target? Based on: https://stackoverflow.com/questions/10485743/contains-method-for-a-slice

func IsErr

func IsErr(t *testing.T, err error, msg string)

IsErr - Should return an error condition

func NotErr

func NotErr(t *testing.T, err error)

NotErr - Check to see if the returned 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