-
Notifications
You must be signed in to change notification settings - Fork 607
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
367f933
commit 00e2b76
Showing
2 changed files
with
18 additions
and
14 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,18 @@ | ||
package osmoutils | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
// ConditionalPanic checks if expectPanic is true, asserts that sut (system under test) | ||
// panics. If expectPanic is false, asserts that sut does not panic. | ||
// returns true if sut panics and false it it does not | ||
func ConditionalPanic(t *testing.T, expectPanic bool, sut func()) { | ||
if expectPanic { | ||
require.Panics(t, sut) | ||
return | ||
} | ||
require.NotPanics(t, sut) | ||
} |