(t *testing.T)
| 4117 | } |
| 4118 | |
| 4119 | func 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 | |
| 4143 | func TestCommand_Timestamp(t *testing.T) { |
| 4144 | t1 := time.Time{}.Add(12 * time.Second) |