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

Function TestCommand_Float64Flag

command_test.go:1443–1458  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1441}
1442
1443func TestCommand_Float64Flag(t *testing.T) {
1444 var meters float64
1445
1446 cmd := &Command{
1447 Flags: []Flag{
1448 &FloatFlag{Name: "height", Value: 1.5, Usage: "Set the height, in meters"},
1449 },
1450 Action: func(_ context.Context, cmd *Command) error {
1451 meters = cmd.Float("height")
1452 return nil
1453 },
1454 }
1455
1456 _ = cmd.Run(buildTestContext(t), []string{"", "--height", "1.93"})
1457 assert.Equal(t, 1.93, meters)
1458}
1459
1460func TestCommand_ParseSliceFlags(t *testing.T) {
1461 var parsedIntSlice []int64

Callers

nothing calls this directly

Calls 3

FloatMethod · 0.95
RunMethod · 0.95
buildTestContextFunction · 0.85

Tested by

no test coverage detected