From 8e9bb454d1d819796c66cb6a20b69ea592f9c39c Mon Sep 17 00:00:00 2001 From: Tom Fleet Date: Tue, 15 Aug 2023 08:49:07 +0100 Subject: [PATCH] Update README showing test.Err (#3) --- README.md | 1 + test_test.go | 1 + 2 files changed, 2 insertions(+) diff --git a/README.md b/README.md index 23e1ea8..2a5228d 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,7 @@ func TestSomething(t *testing.T) { err := doSomething() test.Ok(t, err) // Fails if err != nil + test.Err(t, err) // Fails if err == nil test.True(t, true) // Passes test.False(t, true) // Fails diff --git a/test_test.go b/test_test.go index 5e605ff..c7575fd 100644 --- a/test_test.go +++ b/test_test.go @@ -115,6 +115,7 @@ func TestFail(t *testing.T) { } } + // All functions that should fail their test TB failFns := []func(tb testing.TB){ func(tb testing.TB) { test.Equal(tb, "something", "else") }, func(tb testing.TB) { test.Equal(tb, 42, 27) },