Back to godoc.org

Package test

v1.3.0
Latest Go to latest

The latest major version is v2.

Published: Feb 8, 2019 | License: Apache-2.0 | Module: github.com/graniticio/granitic

Overview

Package test provides tools for Granitic's unit tests.

One of Granitic's design principles is that Granitic should not introduce dependencies on third-party libraries, so this package contains convenience methods for making Grantic's built-in unit tests more usable and readable that would be better served by a third-party test library.

These methods are not recommended for use in user applications or tests.

Index

func ExpectBool

func ExpectBool(t *testing.T, check, expected bool) bool

ExpectBool stops a test and logs an error if the bool to be checked does not have the expected value.

func ExpectFloat

func ExpectFloat(t *testing.T, check, expected float64) bool

ExpectFloat stops a test and logs an error if the float to be checked does not have the expected value.

func ExpectInt

func ExpectInt(t *testing.T, check, expected int) bool

ExpectInt stops a test and logs an error if the int to be checked does not have the expected value.

func ExpectNil

func ExpectNil(t *testing.T, check interface{}) bool

ExpectNil stops a test and logs an error if the value to check is not nil

func ExpectNotNil

func ExpectNotNil(t *testing.T, check interface{}) bool

ExpectNil stops a test and logs an error if the value to check is nil

func ExpectString

func ExpectString(t *testing.T, check, expected string) bool

ExpectString stops a test and logs an error if the string to be checked does not have the expected value.

func TestFilePath

func TestFilePath(file string) string

TestFilePath finds the absolute path of a file that is provided relative to the resource/test directory.

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier