-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
120 additions
and
8 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package graphql | ||
|
||
import ( | ||
"bytes" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestString(t *testing.T) { | ||
assert.Equal(t, `"hello"`, doStrMarshal("hello")) | ||
assert.Equal(t, `"he\tllo"`, doStrMarshal("he\tllo")) | ||
assert.Equal(t, `"he\tllo"`, doStrMarshal("he llo")) | ||
assert.Equal(t, `"he\nllo"`, doStrMarshal("he\nllo")) | ||
assert.Equal(t, `"he\r\nllo"`, doStrMarshal("he\r\nllo")) | ||
assert.Equal(t, `"he\\llo"`, doStrMarshal(`he\llo`)) | ||
assert.Equal(t, `"quotes\"nested\"in\"quotes\""`, doStrMarshal(`quotes"nested"in"quotes"`)) | ||
assert.Equal(t, `"\u0000"`, doStrMarshal("\u0000")) | ||
assert.Equal(t, `"\u0000"`, doStrMarshal("\u0000")) | ||
assert.Equal(t, "\"\U000fe4ed\"", doStrMarshal("\U000fe4ed")) | ||
} | ||
|
||
func doStrMarshal(s string) string { | ||
var buf bytes.Buffer | ||
MarshalString(s).MarshalGQL(&buf) | ||
return buf.String() | ||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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