summaryrefslogtreecommitdiff
path: root/util_test.go
diff options
context:
space:
mode:
authorGrégoire Duchêne <gduchene@awhk.org>2022-06-05 18:01:39 +0100
committerGrégoire Duchêne <gduchene@awhk.org>2022-06-05 18:01:39 +0100
commit0315338ef5c5fadd739088684323b82535fc904b (patch)
treec7febbf73ef122cd7c46f3e6e81c09432c8d4987 /util_test.go
parent326a741c1298959e5d6e5eb1a6b2225ef9151063 (diff)
Add Listen, Must, PipeListener, and T
Diffstat (limited to 'util_test.go')
-rw-r--r--util_test.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/util_test.go b/util_test.go
new file mode 100644
index 0000000..65cc3bc
--- /dev/null
+++ b/util_test.go
@@ -0,0 +1,20 @@
+package core_test
+
+import (
+ "errors"
+ "testing"
+
+ "github.com/google/go-cmp/cmp"
+ "github.com/google/go-cmp/cmp/cmpopts"
+
+ "go.awhk.org/core"
+)
+
+func TestMust(s *testing.T) {
+ t := core.T{T: s, Options: []cmp.Option{cmpopts.EquateErrors()}}
+
+ err := errors.New("some error")
+ t.AssertPanicsWith(func() { core.Must(42, err) }, err)
+ t.AssertNotPanics(func() { core.Must(42, nil) })
+ t.AssertEqual(42, core.Must(42, nil))
+}