(t *testing.T)
| 75 | } |
| 76 | |
| 77 | func TestDSDefault(t *testing.T) { |
| 78 | var ds []time.Duration |
| 79 | f := setUpDSFlagSetWithDefault(&ds) |
| 80 | |
| 81 | vals := []string{"0s", "1ns"} |
| 82 | |
| 83 | err := f.Parse([]string{}) |
| 84 | if err != nil { |
| 85 | t.Fatal("expected no error; got", err) |
| 86 | } |
| 87 | for i, v := range ds { |
| 88 | d, err := time.ParseDuration(vals[i]) |
| 89 | if err != nil { |
| 90 | t.Fatalf("got error: %v", err) |
| 91 | } |
| 92 | if d != v { |
| 93 | t.Fatalf("expected ds[%d] to be %d but got: %d", i, d, v) |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | getDS, err := f.GetDurationSlice("ds") |
| 98 | if err != nil { |
| 99 | t.Fatal("got an error from GetDurationSlice():", err) |
| 100 | } |
| 101 | for i, v := range getDS { |
| 102 | d, err := time.ParseDuration(vals[i]) |
| 103 | if err != nil { |
| 104 | t.Fatal("got an error from GetDurationSlice():", err) |
| 105 | } |
| 106 | if d != v { |
| 107 | t.Fatalf("expected ds[%d] to be %d from GetDurationSlice but got: %d", i, d, v) |
| 108 | } |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | func TestDSWithDefault(t *testing.T) { |
| 113 | var ds []time.Duration |
nothing calls this directly
no test coverage detected