summaryrefslogtreecommitdiff
path: root/must/must.go
blob: 67a58dd7a53d317fb22bd9594e1059e7a7709e11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// package must contains functions for checking values in unit tests.
//
// The functions in this package handle check failures by logging a message
// containing the relevant values, and aborting the test immediately as failed.
//
// For analogues which allow the remainder of the test to run, see package
// assert.
package must

import (
	"testing"

	"git.tjp.lol/assert"
)

// Equal asserts that two values compare as equal.
func Equal(t testing.TB, actual, expect any) {
	t.Helper()
	if !assert.Equal(t, actual, expect) {
		t.FailNow()
	}
}

// NotEqual asserts that two values compare as unequal.
func NotEqual(t testing.TB, actual, expect any) {
	t.Helper()
	if !assert.NotEqual(t, actual, expect) {
		t.FailNow()
	}
}