MCPcopy
hub / github.com/urfave/cli / TestArgsUintSliceTypes

Function TestArgsUintSliceTypes

args_test.go:173–196  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

171}
172
173func TestArgsUintSliceTypes(t *testing.T) {
174 cmd := buildMinimalTestCommand()
175 var ival []uint
176 cmd.Arguments = []Argument{
177 &UintArgs{
178 Name: "ia",
179 Min: 1,
180 Max: -1,
181 Destination: &ival,
182 },
183 }
184
185 err := cmd.Run(buildTestContext(t), []string{"foo", "10", "20", "30"})
186 r := require.New(t)
187 r.NoError(err)
188 r.Equal([]uint{10, 20, 30}, ival)
189 r.Equal([]uint{10, 20, 30}, cmd.UintArgs("ia"))
190 r.Nil(cmd.Uint8Args("ia"))
191 r.Nil(cmd.Uint16Args("ia"))
192 r.Nil(cmd.Uint32Args("ia"))
193 r.Nil(cmd.Uint64Args("ia"))
194
195 r.Error(cmd.Run(buildTestContext(t), []string{"foo", "10", "20.0"}))
196}
197
198func TestArgumentsRootCommand(t *testing.T) {
199 tests := []struct {

Callers

nothing calls this directly

Calls 9

buildMinimalTestCommandFunction · 0.85
buildTestContextFunction · 0.85
UintArgsMethod · 0.80
Uint8ArgsMethod · 0.80
Uint16ArgsMethod · 0.80
Uint32ArgsMethod · 0.80
Uint64ArgsMethod · 0.80
RunMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…