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

Function TestArgsUintTypes

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

Source from the content-addressed store, hash-verified

147}
148
149func TestArgsUintTypes(t *testing.T) {
150 cmd := buildMinimalTestCommand()
151 var ival uint
152 cmd.Arguments = []Argument{
153 &UintArg{
154 Name: "ia",
155 Destination: &ival,
156 },
157 }
158
159 err := cmd.Run(buildTestContext(t), []string{"foo", "10"})
160 r := require.New(t)
161 r.NoError(err)
162 r.Equal(uint(10), ival)
163 r.Equal(uint(10), cmd.UintArg("ia"))
164 r.Equal(uint(0), cmd.UintArg("iab"))
165 r.Equal(uint8(0), cmd.Uint8Arg("ia"))
166 r.Equal(uint16(0), cmd.Uint16Arg("ia"))
167 r.Equal(uint32(0), cmd.Uint32Arg("ia"))
168 r.Equal(uint64(0), cmd.Uint64Arg("ia"))
169
170 r.Error(cmd.Run(buildTestContext(t), []string{"foo", "10.0"}))
171}
172
173func TestArgsUintSliceTypes(t *testing.T) {
174 cmd := buildMinimalTestCommand()

Callers

nothing calls this directly

Calls 9

buildMinimalTestCommandFunction · 0.85
buildTestContextFunction · 0.85
UintArgMethod · 0.80
Uint8ArgMethod · 0.80
Uint16ArgMethod · 0.80
Uint32ArgMethod · 0.80
Uint64ArgMethod · 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…