(t *testing.T)
| 223 | } |
| 224 | |
| 225 | func TestEncodeNestedInterface(t *testing.T) { |
| 226 | val := map[string]any{ |
| 227 | "foo": []any{ |
| 228 | "1", "2", "3", "5", |
| 229 | map[string]any{ |
| 230 | "bar": "baz", |
| 231 | }, |
| 232 | }, |
| 233 | "bar": map[string]any{ |
| 234 | "baz": "quux", |
| 235 | "quux": "quuz", |
| 236 | }, |
| 237 | } |
| 238 | buf := new(bytes.Buffer) |
| 239 | fds := make([]int, 0) |
| 240 | order := binary.LittleEndian |
| 241 | enc := newEncoder(buf, binary.LittleEndian, fds) |
| 242 | err := enc.Encode(val) |
| 243 | if err != nil { |
| 244 | t.Fatal(err) |
| 245 | } |
| 246 | |
| 247 | dec := newDecoder(buf, order, enc.fds) |
| 248 | v, err := dec.Decode(SignatureOf(val)) |
| 249 | if err != nil { |
| 250 | t.Fatal(err) |
| 251 | } |
| 252 | out := map[string]any{} |
| 253 | if err := Store(v, &out); err != nil { |
| 254 | t.Fatal(err) |
| 255 | } |
| 256 | if !reflect.DeepEqual(out, val) { |
| 257 | t.Errorf("not equal: got '%#v', want '%#v'", |
| 258 | out, val) |
| 259 | } |
| 260 | } |
| 261 | |
| 262 | func TestEncodeInt(t *testing.T) { |
| 263 | val := 10 |
nothing calls this directly
no test coverage detected
searching dependent graphs…