summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2024-10-06 06:35:01 -0300
committerEuAndreh <eu@euandre.org>2024-10-06 06:35:05 -0300
commit0563e727059f78b6365206869287b0dc4d192973 (patch)
treef02dcd912654add6aaf1b1b755911251650461b3 /tests
parentAdd noop mkdeps.sh and empty deps.mk (diff)
downloadgobang-0563e727059f78b6365206869287b0dc4d192973.tar.gz
gobang-0563e727059f78b6365206869287b0dc4d192973.tar.xz
src/gobang.go: Change Some{,Fn}Error() to receive varargs over array
Only to improve usability, e.g. no need to declare a [](func() error) variable.
Diffstat (limited to 'tests')
-rw-r--r--tests/gobang.go35
1 files changed, 6 insertions, 29 deletions
diff --git a/tests/gobang.go b/tests/gobang.go
index 3033268..9073b66 100644
--- a/tests/gobang.go
+++ b/tests/gobang.go
@@ -49,28 +49,17 @@ func test_SomeError() {
TestStart("SomeError()")
Testing("an empty array is nil", func() {
- given := []error{}
- TAssertEqual(SomeError(given), nil)
+ TAssertEqual(SomeError(), nil)
})
Testing("only nil values is nil", func() {
- given := []error{
- nil,
- nil,
- nil,
- }
- TAssertEqual(SomeError(given), nil)
+ TAssertEqual(SomeError(nil, nil, nil), nil)
})
Testing("we get the first non-nil value", func() {
err1 := errors.New("error 1")
err2 := errors.New("error 2")
- given := []error{
- nil,
- err1,
- err2,
- }
- TAssertEqual(SomeError(given), err1)
+ TAssertEqual(SomeError(nil, err1, err2), err1)
})
}
@@ -78,8 +67,7 @@ func test_SomeFnError() {
TestStart("SomeFnError()")
Testing("an empty arrays is also nil", func() {
- given := [](func() error){}
- TAssertEqual(SomeFnError(given), nil)
+ TAssertEqual(SomeFnError(), nil)
})
Testing("all functions are called", func() {
@@ -88,12 +76,7 @@ func test_SomeFnError() {
i++
return nil
}
- given := [](func() error){
- fn,
- fn,
- fn,
- }
- TAssertEqual(SomeFnError(given), nil)
+ TAssertEqual(SomeFnError(fn, fn, fn), nil)
TAssertEqual(i, 3)
})
@@ -110,13 +93,7 @@ func test_SomeFnError() {
i++
return errs[i]
}
- given := [](func() error){
- fn,
- fn,
- fn,
- fn,
- }
- TAssertEqual(SomeFnError(given), errs[2])
+ TAssertEqual(SomeFnError(fn, fn, fn, fn), errs[2])
TAssertEqual(i, 4)
})
}