Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lcaballero/exam
Overly simplistic testing assertion library for Go (Golang).
https://github.com/lcaballero/exam
Last synced: 23 days ago
JSON representation
Overly simplistic testing assertion library for Go (Golang).
- Host: GitHub
- URL: https://github.com/lcaballero/exam
- Owner: lcaballero
- License: epl-1.0
- Created: 2016-05-17T17:05:22.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-01-03T18:45:28.000Z (about 7 years ago)
- Last Synced: 2024-06-20T15:01:18.297Z (7 months ago)
- Language: Go
- Size: 26.4 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.html
- License: license
Awesome Lists containing this project
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; }
/*]]>*/-->/*
@licstart The following is the entire license notice for the
JavaScript code in this tag.Copyright (C) 2012-2013 Free Software Foundation, Inc.
The JavaScript code in this tag is free software: you can
redistribute it and/or modify it under the terms of the GNU
General Public License (GNU GPL) as published by the Free Software
Foundation, either version 3 of the License, or (at your option)
any later version. The code is distributed WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.As additional permission under GNU GPL version 3 section 7, you
may distribute non-source (e.g., minimized or compacted) forms of
that code without the copy of the GNU GPL normally required by
section 4, provided you include this license notice and a URL
through which recipients can access the Corresponding Source.@licend The above is the entire license notice
for the JavaScript code in this tag.
*/
<!--/*--><![CDATA[/*><!--*/
function CodeHighlightOn(elem, id)
{
var target = document.getElementById(id);
if(null != target) {
elem.cacheClassElem = elem.className;
elem.cacheClassTarget = target.className;
target.className = "code-highlighted";
elem.className = "code-highlighted";
}
}
function CodeHighlightOff(elem, id)
{
var target = document.getElementById(id);
if(elem.cacheClassElem)
elem.className = elem.cacheClassElem;
if(elem.cacheClassTarget)
target.className = elem.cacheClassTarget;
}
/*]]>*///-->Table of Contents
1. Introduction
- 1.1. Overview
- 1.2. Installation
1.3. Usage
- 1.3.1. IsZero(t, actual, expected)
- 1.3.2. IsEqInt(t, actual, expected)
- 1.3.3. GreaterThan(t, actual, expected)
- 1.3.4. IsTrue(t, actual)
- 1.3.5. IsFalse(t, actual)
- 1.3.6. IsEqBytes(t, actual)
- 1.3.7. IsEqByte(t, actual)
- 1.3.8. IsNotNil(t, actual)
- 1.3.9. IsNil(t, actual)
- 1.3.10. ShouldPanic(t, fn)
- 1.3.11. ShouldNotPanic(t, fn)
1.4. License
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 Installationgo 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.