MCPcopy Index your code
hub / github.com/urfave/cli / TestCommand_Timestamp

Function TestCommand_Timestamp

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

Source from the content-addressed store, hash-verified

4141}
4142
4143func TestCommand_Timestamp(t *testing.T) {
4144 t1 := time.Time{}.Add(12 * time.Second)
4145 t2 := time.Time{}.Add(13 * time.Second)
4146
4147 cmd := &Command{
4148 Name: "hello",
4149 Flags: []Flag{
4150 &TimestampFlag{
4151 Name: "myflag",
4152 Value: t1,
4153 },
4154 },
4155 Action: func(ctx context.Context, c *Command) error {
4156 return nil
4157 },
4158 }
4159
4160 pCmd := &Command{
4161 Flags: []Flag{
4162 &TimestampFlag{
4163 Name: "top-flag",
4164 Value: t2,
4165 },
4166 },
4167 Commands: []*Command{
4168 cmd,
4169 },
4170 }
4171
4172 err := pCmd.Run(context.Background(), []string{"foo", "hello"})
4173 assert.NoError(t, err)
4174
4175 r := require.New(t)
4176 r.Equal(t1, cmd.Timestamp("myflag"))
4177 r.Equal(t2, cmd.Timestamp("top-flag"))
4178}
4179
4180func TestCommand_String(t *testing.T) {
4181 pCmd := &Command{

Callers

nothing calls this directly

Calls 2

RunMethod · 0.95
TimestampMethod · 0.95

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…