summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/gobang.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/gobang.go b/tests/gobang.go
index b6039af..c1286cd 100644
--- a/tests/gobang.go
+++ b/tests/gobang.go
@@ -15,6 +15,32 @@ import (
+func test_Must() {
+ TestStart("Must()")
+
+ myErr := errors.New("test error")
+ f := func(shouldError bool) (string, error) {
+ if shouldError {
+ return "UNSEEN", myErr
+ }
+
+ return "no error", nil
+ }
+
+
+ Testing("value when error is nil", func() {
+ TAssertEqual(Must(f(false)), "no error")
+ })
+
+ Testing("panic when we have an error", func() {
+ defer func() {
+ TAssertEqual(recover(), myErr)
+ }()
+ Must(f(true))
+ TErrorNil(nil)
+ })
+}
+
func test_Clamp() {
TestStart("Clamp()")
@@ -1307,6 +1333,7 @@ func test_setHostname() {
func MainTest() {
Init()
+ test_Must()
test_Clamp()
test_ValidateSQLTablePrefix()
test_WrapErrors()