-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This change introduces better error assertions, prompted by a comment from Albert Teoh here: #615 (comment) The change introduces two new test helper functions: - expectErrIs(tb testing.TB, err, want error) - expectErrAs(tb testing.TB, err error, target interface{}) These wrap `errors.Is` and `errors.As` functions from the standard library, respectively. In order for this to work, the `mismatchedGeometryCollectionDimsError` must be exported, but _only during tests_ (because we don't want to expose it to users of the library). This is achieved by using type aliases in a `_test.go` file in the `geom` package. Because `_test.go` files are only included during tests, this is a safe way to expose the type only during tests.
- Loading branch information
1 parent
d1a3d0b
commit 36542f9
Showing
5 changed files
with
26 additions
and
5 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,3 @@ | ||
package geom | ||
|
||
type MismatchedGeometryCollectionDimsError = mismatchedGeometryCollectionDimsError |
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
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