-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix encoding RawMessage that contains leading space (#136)
* fix encoding RawMessage that contains leading space. * add json/bugs/issue136
- Loading branch information
1 parent
3b49d71
commit 6dfc1b0
Showing
7 changed files
with
25 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package main | ||
|
||
import ( | ||
"bytes" | ||
"testing" | ||
|
||
"github.com/segmentio/encoding/json" | ||
) | ||
|
||
func TestIssue136(t *testing.T) { | ||
input := json.RawMessage(` null`) | ||
|
||
got, err := json.Marshal(input) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
want := bytes.TrimSpace(input) | ||
|
||
if !bytes.Equal(got, want) { | ||
t.Fatalf("Marshal(%q) = %q, want %q", input, got, want) | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters