json/bugs/issue136/main_test.go
raw| 1 | package main |
| 2 | |
| 3 | import ( |
| 4 | "bytes" |
| 5 | "testing" |
| 6 | |
| 7 | "github.com/segmentio/encoding/json" |
| 8 | ) |
| 9 | |
| 10 | func TestIssue136(t *testing.T) { |
| 11 | input := json.RawMessage(` null`) |
| 12 | |
| 13 | got, err := json.Marshal(input) |
| 14 | if err != nil { |
| 15 | t.Fatal(err) |
| 16 | } |
| 17 | |
| 18 | want := bytes.TrimSpace(input) |
| 19 | |
| 20 | if !bytes.Equal(got, want) { |
| 21 | t.Fatalf("Marshal(%q) = %q, want %q", input, got, want) |
| 22 | } |
| 23 | } |