Skip to content

Commit

Permalink
matts comment
Browse files Browse the repository at this point in the history
  • Loading branch information
stackman27 committed Jul 5, 2022
1 parent 367f933 commit 00e2b76
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
14 changes: 0 additions & 14 deletions osmoutils/cli_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ import (
"fmt"
"strconv"
"strings"
"testing"

"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/testutil/network"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/stretchr/testify/require"
)

func DefaultFeeString(cfg network.Config) string {
Expand Down Expand Up @@ -49,15 +47,3 @@ func ParseSdkIntFromString(s string, separator string) ([]sdk.Int, error) {
}
return parsedInts, nil
}

// 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 doesnot
func ConditionalPanic(t *testing.T, expectPanic bool, sut func()) {
if expectPanic {
require.Panics(t, sut)
return
}

require.NotPanics(t, sut)
}
18 changes: 18 additions & 0 deletions osmoutils/test_helpers.go
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)
}

0 comments on commit 00e2b76

Please sign in to comment.