Skip to content

Commit

Permalink
test(provider): test MustNewCustom
Browse files Browse the repository at this point in the history
  • Loading branch information
favonia committed Sep 10, 2023
1 parent 9d10865 commit 095f9a7
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions internal/provider/custom_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,29 @@ func TestNewCustom(t *testing.T) {
})
}
}

func TestMustNewCustom(t *testing.T) {
t.Parallel()

for _, tc := range []struct {
input string
ok bool
}{
{"https://1.2.3.4", true},
{":::::", false},
{"http://1.2.3.4", true},
{"ftp://1.2.3.4", false},
{"", false},
} {
tc := tc
t.Run(tc.input, func(t *testing.T) {
t.Parallel()

if tc.ok {
require.NotPanics(t, func() { provider.MustNewCustom(tc.input) })
} else {
require.Panics(t, func() { provider.MustNewCustom(tc.input) })
}
})
}
}

0 comments on commit 095f9a7

Please sign in to comment.