diff options
Diffstat (limited to 'tests/gobang.go')
-rw-r--r-- | tests/gobang.go | 35 |
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) }) } |