Assert/README.md
2025-02-15 16:52:59 -06:00

1009 B

Assert

Very simple tools for test assertions. Why doesn't Go have assertions built in? Anyone's guess! All credit to Eduard Urbach. The only reason this package exists is to keep a local copy of it for myself, and to handle stylistic differences.

Features

  • Simple API; few brain cells required
  • Tiny codebase; little overhead
  • Zero dependencies; self-contained, built-in Go code. It's predictable!

Installation

go get git.sharkk.net/Go/Assert

Usage

assert.Nil(t, nil)
assert.True(t, true)
assert.Equal(t, "Hello", "Hello")
assert.DeepEqual(t, "Hello", "Hello")
assert.Contains(t, "Hello", "ello")

Tests

PASS: TestContains
PASS: TestNotContains
PASS: TestFailContains
PASS: TestFailNotContains
PASS: TestEqual
PASS: TestNotEqual
PASS: TestDeepEqual
PASS: TestFailEqual
PASS: TestFailNotEqual
PASS: TestFailDeepEqual
PASS: TestNil
PASS: TestNotNil
PASS: TestFailNil
PASS: TestFailNotNil
PASS: TestTrue
coverage: 100.0% of statements