diff options
-rw-r--r-- | bytesconv_test.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/bytesconv_test.go b/bytesconv_test.go index 297b4a1..cf4a12e 100644 --- a/bytesconv_test.go +++ b/bytesconv_test.go @@ -6,12 +6,28 @@ import ( "fmt" "html" "net" + "net/url" "testing" "time" "github.com/valyala/bytebufferpool" ) +func TestAppendQuotedArg(t *testing.T) { + t.Parallel() + + // Sync with url.QueryEscape + allcases := make([]byte, 256) + for i := 0; i < 256; i++ { + allcases[i] = byte(i) + } + res := string(AppendQuotedArg(nil, allcases)) + expect := url.QueryEscape(string(allcases)) + if res != expect { + t.Fatalf("unexpected string %q. Expecting %q.", res, expect) + } +} + func TestAppendHTMLEscape(t *testing.T) { t.Parallel() |