summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/gobang.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/gobang.go b/tests/gobang.go
index c1286cd..32f6d99 100644
--- a/tests/gobang.go
+++ b/tests/gobang.go
@@ -15,6 +15,27 @@ import (
+func test_PanicIf() {
+ TestStart("PanicIf()")
+
+ myErr := errors.New("test error")
+
+
+ Testing("noop when error is nil", func() {
+ var err error
+ PanicIf(err)
+ PanicIf(nil)
+ })
+
+ Testing("panic when we have an error", func() {
+ defer func() {
+ TAssertEqual(recover(), myErr)
+ }()
+ PanicIf(myErr)
+ TErrorNil(nil)
+ })
+}
+
func test_Must() {
TestStart("Must()")
@@ -1333,6 +1354,7 @@ func test_setHostname() {
func MainTest() {
Init()
+ test_PanicIf()
test_Must()
test_Clamp()
test_ValidateSQLTablePrefix()