MCPcopy Create free account
hub / github.com/segmentio/encoding / TestStringKind

Function TestStringKind

json/golang_decode_test.go:1913–1934  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1911}
1912
1913func TestStringKind(t *testing.T) {
1914 type stringKind string
1915
1916 var m1, m2 map[stringKind]int
1917 m1 = map[stringKind]int{
1918 "foo": 42,
1919 }
1920
1921 data, err := Marshal(m1)
1922 if err != nil {
1923 t.Errorf("Unexpected error marshaling: %v", err)
1924 }
1925
1926 err = Unmarshal(data, &m2)
1927 if err != nil {
1928 t.Errorf("Unexpected error unmarshaling: %v", err)
1929 }
1930
1931 if !reflect.DeepEqual(m1, m2) {
1932 t.Error("Items should be equal after encoding and then decoding")
1933 }
1934}
1935
1936// Custom types with []byte as underlying type could not be marshaled
1937// and then unmarshaled.

Callers

nothing calls this directly

Calls 3

MarshalFunction · 0.70
UnmarshalFunction · 0.70
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…