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

Function TestEmptySA

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

Source from the content-addressed store, hash-verified

22}
23
24func TestEmptySA(t *testing.T) {
25 var sa []string
26 f := setUpSAFlagSet(&sa)
27 err := f.Parse([]string{})
28 if err != nil {
29 t.Fatal("expected no error; got", err)
30 }
31
32 getSA, err := f.GetStringArray("sa")
33 if err != nil {
34 t.Fatal("got an error from GetStringArray():", err)
35 }
36 if len(getSA) != 0 {
37 t.Fatalf("got sa %v with len=%d but expected length=0", getSA, len(getSA))
38 }
39}
40
41func TestEmptySAValue(t *testing.T) {
42 var sa []string

Callers

nothing calls this directly

Calls 3

setUpSAFlagSetFunction · 0.85
GetStringArrayMethod · 0.80
ParseMethod · 0.65

Tested by

no test coverage detected