Categorygithub.com/lcaballero/exam
repositorypackage
0.0.0-20161106051532-e9bd3d22cf93
Repository: https://github.com/lcaballero/exam.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author

# README

<!--/*--><![CDATA[/*><!--*/ .title { text-align: center; margin-bottom: .2em; } .subtitle { text-align: center; font-size: medium; font-weight: bold; margin-top:0; } .todo { font-family: monospace; color: red; } .done { font-family: monospace; color: green; } .priority { font-family: monospace; color: orange; } .tag { background-color: #eee; font-family: monospace; padding: 2px; font-size: 80%; font-weight: normal; } .timestamp { color: #bebebe; } .timestamp-kwd { color: #5f9ea0; } .org-right { margin-left: auto; margin-right: 0px; text-align: right; } .org-left { margin-left: 0px; margin-right: auto; text-align: left; } .org-center { margin-left: auto; margin-right: auto; text-align: center; } .underline { text-decoration: underline; } #postamble p, #preamble p { font-size: 90%; margin: .2em; } p.verse { margin-left: 3%; } pre { border: 1px solid #ccc; box-shadow: 3px 3px 3px #eee; padding: 8pt; font-family: monospace; overflow: auto; margin: 1.2em; } pre.src { position: relative; overflow: visible; padding-top: 1.2em; } pre.src:before { display: none; position: absolute; background-color: white; top: -10px; right: 10px; padding: 3px; border: 1px solid black; } pre.src:hover:before { display: inline;} pre.src-sh:before { content: 'sh'; } pre.src-bash:before { content: 'sh'; } pre.src-emacs-lisp:before { content: 'Emacs Lisp'; } pre.src-R:before { content: 'R'; } pre.src-perl:before { content: 'Perl'; } pre.src-java:before { content: 'Java'; } pre.src-sql:before { content: 'SQL'; } table { border-collapse:collapse; } caption.t-above { caption-side: top; } caption.t-bottom { caption-side: bottom; } td, th { vertical-align:top; } th.org-right { text-align: center; } th.org-left { text-align: center; } th.org-center { text-align: center; } td.org-right { text-align: right; } td.org-left { text-align: left; } td.org-center { text-align: center; } dt { font-weight: bold; } .footpara { display: inline; } .footdef { margin-bottom: 1em; } .figure { padding: 1em; } .figure p { text-align: center; } .inlinetask { padding: 10px; border: 2px solid gray; margin: 10px; background: #ffffcc; } #org-div-home-and-up { text-align: right; font-size: 70%; white-space: nowrap; } textarea { overflow-x: auto; } .linenr { font-size: smaller } .code-highlighted { background-color: #ffff00; } .org-info-js_info-navigation { border-style: none; } #org-info-js_console-label { font-size: 10px; font-weight: bold; white-space: nowrap; } .org-info-js_search-highlight { background-color: #ffff00; color: #000000; font-weight: bold; } /]]>/-->

1 Introduction

1.1 Overview

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

1.2 Installation

go get github.com/lcaballero/exam

1.3 Usage

1.3.1 IsZero(t, actual, expected)

n := 0
IsZero(t, n)

1.3.2 IsEqInt(t, actual, expected)

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

1.3.3 GreaterThan(t, actual, expected)

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

1.3.4 IsTrue(t, actual)

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

1.3.5 IsFalse(t, actual)

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

1.3.6 IsEqBytes(t, actual)

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

1.3.7 IsEqByte(t, actual)

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

1.3.8 IsNotNil(t, actual)

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

1.3.9 IsNil(t, actual)

var my *mystruct
IsNil(t, my)

1.3.10 ShouldPanic(t, fn)

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

1.3.11 ShouldNotPanic(t, fn)

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

1.4 License

1.4.1 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.

Author: Lucas Caballero

Created: 2016-10-21 Fri 15:57

Validate