MCPcopy Create free account
hub / github.com/crewjam/saml / TestRelaxedTimeFormat

Function TestRelaxedTimeFormat

time_test.go:13–29  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

11)
12
13func TestRelaxedTimeFormat(t *testing.T) {
14 rt := time.Date(1981, 02, 03, 14, 15, 16, 17, time.UTC)
15 assert.Check(t, is.Equal("1981-02-03T14:15:16Z", RelaxedTime(rt).String()))
16
17 buf, err := RelaxedTime(rt).MarshalText()
18 assert.Check(t, err)
19 assert.Check(t, is.Equal("1981-02-03T14:15:16Z", string(buf)))
20
21 loc, err := time.LoadLocation("America/New_York")
22 assert.Check(t, err)
23 rt = time.Date(1981, 02, 03, 9, 15, 16, 17, loc)
24
25 assert.Check(t, is.Equal("1981-02-03T14:15:16Z", RelaxedTime(rt).String()))
26 buf, err = RelaxedTime(rt).MarshalText()
27 assert.Check(t, err)
28 assert.Check(t, is.Equal("1981-02-03T14:15:16Z", string(buf)))
29}
30
31func TestRelaxedTimeParse(t *testing.T) {
32 {

Callers

nothing calls this directly

Calls 3

RelaxedTimeTypeAlias · 0.85
StringMethod · 0.80
MarshalTextMethod · 0.45

Tested by

no test coverage detected