MCPcopy Create free account
hub / github.com/chanify/chanify / TestParseTimestamp

Function TestParseTimestamp

core/msgparam_test.go:56–80  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

54}
55
56func TestParseTimestamp(t *testing.T) {
57 tm := time.Unix(1620000000, 123000000)
58 if !tm.Equal(*parseTimestamp("1620000000123")) {
59 t.Error("Parse unix time failed")
60 }
61 if !tm.Equal(*parseTimestamp(tm.Format(time.RFC3339Nano))) {
62 t.Error("Parse string time nano failed")
63 }
64 tm2 := time.Unix(1620000000, 0)
65 if !tm2.Equal(*parseTimestamp(tm.Format(time.RFC3339))) {
66 t.Error("Parse string time failed")
67 }
68 if !tm.Equal(*parseTimestamp(1620000000123)) {
69 t.Error("Parse int time failed")
70 }
71 if !tm.Equal(*parseTimestamp(uint(1620000000123))) {
72 t.Error("Parse uint time failed")
73 }
74 if !tm.Equal(*parseTimestamp(int64(1620000000123))) {
75 t.Error("Parse int64 time failed")
76 }
77 if !tm.Equal(*parseTimestamp(uint64(1620000000123))) {
78 t.Error("Parse uint64 failed")
79 }
80}

Callers

nothing calls this directly

Calls 1

parseTimestampFunction · 0.85

Tested by

no test coverage detected