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

Function TestTimestampFlagApply_Timezoned

flag_test.go:2752–2764  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

2750}
2751
2752func TestTimestampFlagApply_Timezoned(t *testing.T) {
2753 pdt := time.FixedZone("PDT", -7*60*60)
2754 expectedResult, _ := time.Parse(time.RFC3339, "2006-01-02T15:04:05Z")
2755 fl := TimestampFlag{Name: "time", Aliases: []string{"t"}, Config: TimestampConfig{Layouts: []string{time.ANSIC}, Timezone: pdt}}
2756 cmd := &Command{
2757 Flags: []Flag{
2758 &fl,
2759 },
2760 }
2761
2762 assert.NoError(t, cmd.Run(buildTestContext(t), []string{"", "--time", "Mon Jan 2 08:04:05 2006"}))
2763 assert.Equal(t, expectedResult.In(pdt), cmd.Value("time"))
2764}
2765
2766func TestTimestampFlagValueFromCommand(t *testing.T) {
2767 now := time.Now()

Callers

nothing calls this directly

Calls 4

RunMethod · 0.95
ValueMethod · 0.95
buildTestContextFunction · 0.85
ParseMethod · 0.65

Tested by

no test coverage detected