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

Function TestEmptyIP

ip_slice_test.go:27–42  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

25}
26
27func TestEmptyIP(t *testing.T) {
28 var ips []net.IP
29 f := setUpIPSFlagSet(&ips)
30 err := f.Parse([]string{})
31 if err != nil {
32 t.Fatal("expected no error; got", err)
33 }
34
35 getIPS, err := f.GetIPSlice("ips")
36 if err != nil {
37 t.Fatal("got an error from GetIPSlice():", err)
38 }
39 if len(getIPS) != 0 {
40 t.Fatalf("got ips %v with len=%d but expected length=0", getIPS, len(getIPS))
41 }
42}
43
44func TestIPS(t *testing.T) {
45 var ips []net.IP

Callers

nothing calls this directly

Calls 3

setUpIPSFlagSetFunction · 0.85
GetIPSliceMethod · 0.80
ParseMethod · 0.65

Tested by

no test coverage detected