MCPcopy
hub / github.com/spf13/pflag / TestEmptyIPNet

Function TestEmptyIPNet

ipnet_slice_test.go:39–54  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

37}
38
39func TestEmptyIPNet(t *testing.T) {
40 var cidrs []net.IPNet
41 f := setUpIPNetFlagSet(&cidrs)
42 err := f.Parse([]string{})
43 if err != nil {
44 t.Fatal("expected no error; got", err)
45 }
46
47 getIPNet, err := f.GetIPNetSlice("cidrs")
48 if err != nil {
49 t.Fatal("got an error from GetIPNetSlice():", err)
50 }
51 if len(getIPNet) != 0 {
52 t.Fatalf("got ips %v with len=%d but expected length=0", getIPNet, len(getIPNet))
53 }
54}
55
56func TestIPNets(t *testing.T) {
57 var ips []net.IPNet

Callers

nothing calls this directly

Calls 3

setUpIPNetFlagSetFunction · 0.85
GetIPNetSliceMethod · 0.80
ParseMethod · 0.65

Tested by

no test coverage detected