summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2024-11-02 04:25:16 -0300
committerEuAndreh <eu@euandre.org>2024-11-02 04:25:16 -0300
commitdb8988c7d8b01efe8311047759b32db51c0a751a (patch)
treeea05eb50bc68bc73d26beedea0b2904446eea694 /tests
parent.gitignore: Include pattern for cgo (diff)
downloadgobang-db8988c7d8b01efe8311047759b32db51c0a751a.tar.gz
gobang-db8988c7d8b01efe8311047759b32db51c0a751a.tar.xz
src/gobang.go: Deal with nil functions in SomeFnError arguments
Diffstat (limited to 'tests')
-rw-r--r--tests/gobang.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/gobang.go b/tests/gobang.go
index c862e82..64e9eb5 100644
--- a/tests/gobang.go
+++ b/tests/gobang.go
@@ -126,6 +126,17 @@ func test_SomeFnError() {
TAssertEqual(SomeFnError(fn, fn, fn, fn), errs[2])
TAssertEqual(i, 4)
})
+
+ Testing("no error if some function is nil", func() {
+ myErr := errors.New("the expected result")
+ TAssertEqual(SomeFnError(
+ func() error { return nil },
+ nil,
+ func() error { return nil },
+ func() error { return myErr },
+ func() error { return nil },
+ ), myErr)
+ })
}
func test_Random() {