map_test.go 631 B

1234567891011121314151617181920212223242526272829303132333435
  1. package test
  2. import "math/big"
  3. func init() {
  4. marshalCases = append(marshalCases,
  5. map[string]interface{}{"abc": 1},
  6. map[string]MyInterface{"hello": MyString("world")},
  7. map[*big.Float]string{big.NewFloat(1.2): "2"},
  8. map[string]interface{}{
  9. "3": 3,
  10. "1": 1,
  11. "2": 2,
  12. },
  13. map[uint64]interface{}{
  14. uint64(1): "a",
  15. uint64(2): "a",
  16. uint64(4): "a",
  17. },
  18. )
  19. unmarshalCases = append(unmarshalCases, unmarshalCase{
  20. ptr: (*map[string]string)(nil),
  21. input: `{"k\"ey": "val"}`,
  22. })
  23. }
  24. type MyInterface interface {
  25. Hello() string
  26. }
  27. type MyString string
  28. func (ms MyString) Hello() string {
  29. return string(ms)
  30. }