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

Function TestTimestamp_set

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

Source from the content-addressed store, hash-verified

2472}
2473
2474func TestTimestamp_set(t *testing.T) {
2475 ts := timestampValue{
2476 timestamp: nil,
2477 hasBeenSet: false,
2478 layouts: []string{"Jan 2, 2006 at 3:04pm (MST)"},
2479 }
2480
2481 time1 := "Feb 3, 2013 at 7:54pm (PST)"
2482 require.NoError(t, ts.Set(time1), "Failed to parse time %s with layouts %v", time1, ts.layouts)
2483 require.True(t, ts.hasBeenSet, "hasBeenSet is not true after setting a time")
2484
2485 ts.hasBeenSet = false
2486 ts.layouts = []string{time.RFC3339}
2487 time2 := "2006-01-02T15:04:05Z"
2488 require.NoError(t, ts.Set(time2), "Failed to parse time %s with layout %v", time2, ts.layouts)
2489 require.True(t, ts.hasBeenSet, "hasBeenSet is not true after setting a time")
2490}
2491
2492func TestTimestampFlagApply_SingleFormat(t *testing.T) {
2493 expectedResult, _ := time.Parse(time.RFC3339, "2006-01-02T15:04:05Z")

Callers

nothing calls this directly

Calls 1

SetMethod · 0.95

Tested by

no test coverage detected