-
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.
test/devux: helper function for assertions conditional on panics (#1964)
* test: helper function for assertions conditional on panics * added devs comments * matts comment (cherry picked from commit 298d7cf) # Conflicts: # x/gamm/pool-models/balancer/pool_suite_test.go # x/mint/keeper/genesis_test.go
- Loading branch information
1 parent
355a41a
commit 0a73938
Showing
5 changed files
with
43 additions
and
18 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
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) | ||
} |
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
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