Help us shape the future of Go! Take the 2026 Go Developer Survey

gounit

package module
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2017 License: MIT Imports: 3 Imported by: 0

README

GoUnit

GoDoc

GoUnit is a testing helper library for Go.

Getting started
  • API documentation and examples are available via godoc.
Installation

To install this package, you need to install Go and setup your Go workspace on your computer. The simplest way to install the library is to run:

$ go get gopkg.in/l-vitaly/gounit.v1
Contribute

Please refer to CONTRIBUTING.md for information on how to contribute to GoUnit.

MIT License

Copyright (c) 2016 Lobchuk Vitaly vitaly@lobchuk.ru

See the file LICENSE for copying permission.

Documentation

Index

Constants

View Source
const (
	// EmptyMessage not show message for assert
	EmptyMessage = ""
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GoUnit

type GoUnit interface {
	// AssertArrayHasKey Reports an error identified by "message" if "array" does
	// not have the "key".
	AssertArrayHasKey(key interface{}, array interface{}, message string)
	// AssertContains Reports an error identified by "message" if "needle" is not
	// an element of "array".
	AssertContains(value interface{}, array interface{}, message string)
	// Reports an error identified by "message" if the number of elements in "array"
	// is not "expectedCount".
	AssertCount(count int, array interface{}, message string)
	// AssertDirectoryExists Reports an error identified by "message" if the
	// directory specified by "dir" does not exist.
	AssertDirectoryExists(dir string, message string)
	// AssertFileExists Reports an error identified by "message" if the file specified
	// by "file" does not exist.
	AssertFileExists(file string, message string)
	// AssertEmpty Reports an error identified by "message" if "actual" is not empty.
	AssertEmpty(actual interface{}, message string)
	// AssertEquals Reports an error identified by "message" if the two variables
	// "expected" and "actual" are not equal.
	AssertEquals(expected interface{}, actual interface{}, message string)
	// AssertTrue Reports an error identified by "message" if "cond" is false.
	AssertTrue(cond bool, message string)
	// AssertFalse Reports an error identified by "message" if "cond" is true.
	AssertFalse(cond bool, message string)
	// AssertFileEquals Reports an error identified by "message: if the file specified
	// by "expected" does not have the same contents as the file specified by "actual".
	AssertFileEquals(expected string, actual string, message string)
	// AssertGreaterThan Reports an error identified by "message" if the value of
	// "actual" is not greater than the value of "expected".
	AssertGreaterThan(expected, actual int, message string)
	// AssertGreaterThanOrEqual Reports an error identified by "message" if the
	// value of "actual" is not greater than or equal to the value of "expected".
	AssertGreaterThanOrEqual(expected, actual int, message string)
	// AssertLessThan Reports an error identified by "message" if the value of
	// "actual" is not less than the value of "expected".
	AssertLessThan(expected, actual int, message string)
	// AssertLessThanOrEqual Reports an error identified by "message" if the value of
	// "actual" is not less than or equal to the value of "expected".
	AssertLessThanOrEqual(expected, actual int, message string)
	//// AssertError Reports an error identified by "message" if "err" is error type
	AssertError(err error, message string)
	// AssertNotError Reports an error identified by "message" if "err" is not error type
	AssertNotError(err error, message string)
	// AssertIsNil Reports an error identified by "message" if "cond" is not nil.
	AssertNil(cond interface{}, message string)
	// AssertIsNotNil Reports an error identified by "message" if "cond" is nil.
	AssertNotNil(cond interface{}, message string)
	// TestCase
	TestCase(x interface{}, fn TestCaseFunc)
}

GoUnit assert helper

func New

func New(tb testing.TB) GoUnit

New create new instance GoUnit

type TestCaseFunc added in v1.0.4

type TestCaseFunc func(i interface{})

Jump to

Keyboard shortcuts

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