MCPcopy Create free account
hub / github.com/facebook/time / TestTimestampMarshalText

Function TestTimestampMarshalText

timestamp/timestamp_test.go:142–163  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

140}
141
142func TestTimestampMarshalText(t *testing.T) {
143 text, err := HW.MarshalText()
144 require.NoError(t, err)
145 require.Equal(t, "hardware", string(text))
146
147 text, err = HWRX.MarshalText()
148 require.NoError(t, err)
149 require.Equal(t, "hardware_rx", string(text))
150
151 text, err = SW.MarshalText()
152 require.NoError(t, err)
153 require.Equal(t, "software", string(text))
154
155 text, err = SWRX.MarshalText()
156 require.NoError(t, err)
157 require.Equal(t, "software_rx", string(text))
158
159 require.Equal(t, Unsupported, Timestamp(42).String())
160 text, err = Timestamp(42).MarshalText()
161 require.Equal(t, errors.New("unknown timestamp type \"Unsupported\""), err)
162 require.Equal(t, "Unsupported", string(text))
163}
164
165func TestNewSockaddrWithPort(t *testing.T) {
166 oldSA := &unix.SockaddrInet4{Addr: [4]byte{1, 2, 3, 4}, Port: 4567}

Callers

nothing calls this directly

Calls 3

MarshalTextMethod · 0.80
TimestampTypeAlias · 0.70
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…