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

Function TestTimestampFlagApply_SingleFormat

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

Source from the content-addressed store, hash-verified

2490}
2491
2492func TestTimestampFlagApply_SingleFormat(t *testing.T) {
2493 expectedResult, _ := time.Parse(time.RFC3339, "2006-01-02T15:04:05Z")
2494 fl := TimestampFlag{Name: "time", Aliases: []string{"t"}, Config: TimestampConfig{Layouts: []string{time.RFC3339}}}
2495 cmd := &Command{
2496 Flags: []Flag{
2497 &fl,
2498 },
2499 }
2500
2501 assert.NoError(t, cmd.Run(buildTestContext(t), []string{"", "--time", "2006-01-02T15:04:05Z"}))
2502 assert.Equal(t, expectedResult, cmd.Value("time"))
2503}
2504
2505func TestTimestampFlagApply_MultipleFormats(t *testing.T) {
2506 now := time.Now().UTC()

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