MCPcopy
hub / github.com/mislav/hub / TestArgsParser_Int

Function TestArgsParser_Int

utils/args_parser_test.go:171–183  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

169}
170
171func 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
185func TestArgsParser_WithUsage(t *testing.T) {
186 p := NewArgsParserWithUsage(`

Callers

nothing calls this directly

Calls 6

RegisterValueMethod · 0.95
ParseMethod · 0.95
HasReceivedMethod · 0.95
IntMethod · 0.95
NewArgsParserFunction · 0.85
equalFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…