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

Function TestEmptyDS

duration_slice_test.go:26–41  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

24}
25
26func TestEmptyDS(t *testing.T) {
27 var ds []time.Duration
28 f := setUpDSFlagSet(&ds)
29 err := f.Parse([]string{})
30 if err != nil {
31 t.Fatal("expected no error; got", err)
32 }
33
34 getDS, err := f.GetDurationSlice("ds")
35 if err != nil {
36 t.Fatal("got an error from GetDurationSlice():", err)
37 }
38 if len(getDS) != 0 {
39 t.Fatalf("got ds %v with len=%d but expected length=0", getDS, len(getDS))
40 }
41}
42
43func TestDS(t *testing.T) {
44 var ds []time.Duration

Callers

nothing calls this directly

Calls 3

setUpDSFlagSetFunction · 0.85
GetDurationSliceMethod · 0.80
ParseMethod · 0.65

Tested by

no test coverage detected