(t *testing.T)
| 14 | } |
| 15 | |
| 16 | func TestArgsParser(t *testing.T) { |
| 17 | p := NewArgsParser() |
| 18 | p.RegisterValue("--hello", "-e") |
| 19 | p.RegisterValue("--origin", "-o") |
| 20 | args := []string{"--hello", "world", "one", "--", "--two"} |
| 21 | rest, err := p.Parse(args) |
| 22 | equal(t, nil, err) |
| 23 | equal(t, []string{"one", "--two"}, rest) |
| 24 | equal(t, "world", p.Value("--hello")) |
| 25 | equal(t, true, p.HasReceived("--hello")) |
| 26 | equal(t, "", p.Value("-e")) |
| 27 | equal(t, false, p.HasReceived("-e")) |
| 28 | equal(t, "", p.Value("--origin")) |
| 29 | equal(t, false, p.HasReceived("--origin")) |
| 30 | equal(t, []int{2, 4}, p.PositionalIndices) |
| 31 | } |
| 32 | |
| 33 | func TestArgsParser_RepeatedInvocation(t *testing.T) { |
| 34 | p := NewArgsParser() |
nothing calls this directly
no test coverage detected
searching dependent graphs…