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

Function TestCommand_Duration

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

Source from the content-addressed store, hash-verified

4117}
4118
4119func TestCommand_Duration(t *testing.T) {
4120 pCmd := &Command{
4121 Flags: []Flag{
4122 &DurationFlag{
4123 Name: "myflag",
4124 Value: 12 * time.Second,
4125 },
4126 },
4127 }
4128 cmd := &Command{
4129 Flags: []Flag{
4130 &DurationFlag{
4131 Name: "top-flag",
4132 Value: 13 * time.Second,
4133 },
4134 },
4135 parent: pCmd,
4136 }
4137
4138 r := require.New(t)
4139 r.Equal(12*time.Second, cmd.Duration("myflag"))
4140 r.Equal(13*time.Second, cmd.Duration("top-flag"))
4141}
4142
4143func TestCommand_Timestamp(t *testing.T) {
4144 t1 := time.Time{}.Add(12 * time.Second)

Callers

nothing calls this directly

Calls 1

DurationMethod · 0.95

Tested by

no test coverage detected