-
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move unused noopError to test. Simplify handleNoOp function (#110)
* Move unused noopError to test. Simplify handleNoOp function * Revert removal of nil check in handleNoOp func * Add test for handleNoOp func in main package * Invert if statements in handleNoOp for consistency * Retrigger checks
- Loading branch information
1 parent
c548eed
commit e0f1fcd
Showing
6 changed files
with
64 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package tensor | ||
|
||
import ( | ||
"github.com/pkg/errors" | ||
"github.com/stretchr/testify/assert" | ||
"testing" | ||
) | ||
|
||
func TestHandleNoOp(t *testing.T) { | ||
otherErr := errors.New("other error") | ||
|
||
assert.Equal(t, nil, handleNoOp(noopError{})) | ||
assert.Equal(t, nil, handleNoOp(nil)) | ||
assert.Equal(t, otherErr, handleNoOp(otherErr)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package execution | ||
|
||
import ( | ||
"github.com/pkg/errors" | ||
"github.com/stretchr/testify/assert" | ||
"testing" | ||
) | ||
|
||
type noopError struct{} | ||
|
||
func (e noopError) NoOp() bool { return true } | ||
func (e noopError) Error() string { return "NoOp" } | ||
|
||
func TestHandleNoOp(t *testing.T) { | ||
otherErr := errors.New("other error") | ||
|
||
assert.Equal(t, nil, handleNoOp(noopError{})) | ||
assert.Equal(t, nil, handleNoOp(nil)) | ||
assert.Equal(t, otherErr, handleNoOp(otherErr)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package storage | ||
|
||
import ( | ||
"github.com/pkg/errors" | ||
"github.com/stretchr/testify/assert" | ||
"testing" | ||
) | ||
|
||
type noopError struct{} | ||
|
||
func (e noopError) NoOp() bool { return true } | ||
func (e noopError) Error() string { return "NoOp" } | ||
|
||
func TestHandleNoOp(t *testing.T) { | ||
otherErr := errors.New("other error") | ||
|
||
assert.Equal(t, nil, handleNoOp(noopError{})) | ||
assert.Equal(t, nil, handleNoOp(nil)) | ||
assert.Equal(t, otherErr, handleNoOp(otherErr)) | ||
} |