(t *testing.T)
| 365 | } |
| 366 | |
| 367 | func TestMarshalJSON(t *testing.T) { |
| 368 | s := &store.Store[string, string]{} |
| 369 | s.Set("a", "test1") |
| 370 | s.Set("b", "test2") |
| 371 | |
| 372 | expected := []byte(`{"a":"test1", "b":"test2"}`) |
| 373 | |
| 374 | result, err := json.Marshal(s) |
| 375 | if err != nil { |
| 376 | t.Fatal(err) |
| 377 | } |
| 378 | |
| 379 | if bytes.Equal(result, expected) { |
| 380 | t.Fatalf("Expected\n%s\ngot\n%s", expected, result) |
| 381 | } |
| 382 | } |
| 383 | |
| 384 | func TestShrink(t *testing.T) { |
| 385 | s := &store.Store[string, int]{} |