Skip to content

Overly simplistic testing assertion library for Go (Golang).

License

Notifications You must be signed in to change notification settings

lcaballero/exam

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GoDoc

Introduction

Overview

exam is a small set of convenience functions designed to help examine and assert values when writing test cases.

Installation

go get github.com/lcaballero/exam

Usage

API

IsZero(t, actual, expected)

n := 0
IsZero(t, n)

IsEqInt(t, actual, expected)

n := 1
IsEqInt(t, n, 1)

GreaterThan(t, actual, expected)

n := 2
GreaterThan(t, n, 1)

IsTrue(t, actual)

n := 3
IsTrue(t, n == 3)

IsFalse(t, actual)

n := 4
IsFalse(t, n == 3)

IsEqBytes(t, actual)

a := []byte{ 'a', 'b', 'c' }
b := []byte("abc")
IsEqBytes(t, a, b)

IsEqByte(t, actual)

a := []byte{ 'a', 'b', 'c' }
b := []byte("abc")
IsEqByte(t, a[1], b[1])

IsNotNil(t, actual)

type mystruct struct {}
my := &mystruct{}
IsNotNil(t, my)

IsNil(t, actual)

var my *mystruct
IsNil(t, my)

ShouldPanic(t, fn)

willPanic := func() {
    panic("panicking... now...")
}
ShouldPanic(t, willPanic)

ShouldNotPanic(t, fn)

dontPanic := func() {
    // panicking... now...
}
ShouldNotPanic(t, dontPanic)

License

See license file.

The use and distribution terms for this software are covered by the EPL-1, which can be found in the file ‘license’ at the root of this distribution. By using this software in any fashion, you are agreeing to be bound by the terms of this license. You must not remove this notice, or any other, from this software.

About

Overly simplistic testing assertion library for Go (Golang).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published