(t *testing.T)
| 169 | } |
| 170 | |
| 171 | func TestArgsParser_Int(t *testing.T) { |
| 172 | p := NewArgsParser() |
| 173 | p.RegisterValue("--limit", "-L") |
| 174 | p.RegisterValue("--depth", "-d") |
| 175 | args := []string{"-L24", "-d", "-3"} |
| 176 | rest, err := p.Parse(args) |
| 177 | equal(t, nil, err) |
| 178 | equal(t, []string{}, rest) |
| 179 | equal(t, true, p.HasReceived("--limit")) |
| 180 | equal(t, 24, p.Int("--limit")) |
| 181 | equal(t, true, p.HasReceived("--depth")) |
| 182 | equal(t, -3, p.Int("--depth")) |
| 183 | } |
| 184 | |
| 185 | func TestArgsParser_WithUsage(t *testing.T) { |
| 186 | p := NewArgsParserWithUsage(` |
nothing calls this directly
no test coverage detected
searching dependent graphs…