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

Function TestTimestampFlagApplyValue

flag_test.go:2716–2727  ·  flag_test.go::TestTimestampFlagApplyValue
(t *testing.T)

Source from the content-addressed store, hash-verified

2714}
2715
2716func TestTimestampFlagApplyValue(t *testing.T) {
2717 expectedResult, _ := time.Parse(time.RFC3339, "2006-01-02T15:04:05Z")
2718 fl := TimestampFlag{Name: "time", Aliases: []string{"t"}, Config: TimestampConfig{Layouts: []string{time.RFC3339}}, Value: expectedResult}
2719 cmd := &Command{
2720 Flags: []Flag{
2721 &fl,
2722 },
2723 }
2724
2725 assert.NoError(t, cmd.Run(buildTestContext(t), []string{""}))
2726 assert.Equal(t, expectedResult, cmd.Value("time"))
2727}
2728
2729func TestTimestampFlagApply_Fail_Parse_Wrong_Layout(t *testing.T) {
2730 fl := TimestampFlag{Name: "time", Aliases: []string{"t"}, Config: TimestampConfig{Layouts: []string{"randomlayout"}}}

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