slice_test.go 500 B

12345678910111213141516171819202122232425
  1. package test
  2. func init() {
  3. nilSlice := []string(nil)
  4. marshalCases = append(marshalCases,
  5. []interface{}{"hello"},
  6. nilSlice,
  7. &nilSlice,
  8. selectedMarshalCase{[]byte{1,2,3}},
  9. )
  10. unmarshalCases = append(unmarshalCases, unmarshalCase{
  11. ptr: (*[]string)(nil),
  12. input: "null",
  13. }, unmarshalCase{
  14. ptr: (*[]string)(nil),
  15. input: "[]",
  16. }, unmarshalCase{
  17. ptr: (*[]byte)(nil),
  18. input: "[1,2,3]",
  19. }, unmarshalCase{
  20. ptr: (*[]byte)(nil),
  21. input: `"aGVsbG8="`,
  22. selected: true,
  23. })
  24. }