| 1911 | } |
| 1912 | |
| 1913 | func 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. |