Skip to content

Commit

Permalink
internal: improve TestMustParseNet
Browse files Browse the repository at this point in the history
  • Loading branch information
ernado committed Sep 2, 2018
1 parent cd0863c commit c143abb
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions internal/net_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,18 @@ package internal
import "testing"

func TestMustParseNet(t *testing.T) {
defer func() {
if recover() == nil {
t.Error("should panic")
t.Run("Negative", func(t *testing.T) {
defer func() {
if recover() == nil {
t.Error("should panic")
}
}()
MustParseNet("___")
})
t.Run("Positive", func(t *testing.T) {
net := MustParseNet("0.0.0.0/0")
if net.String() != "0.0.0.0/0" {
t.Errorf("bad net %s", net)
}
}()
MustParseNet("___")
})
}

0 comments on commit c143abb

Please sign in to comment.