Skip to content

Commit

Permalink
add a test for AppendQuotedArg (valyala#1255)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangyunhao116 authored and u5surf committed Mar 23, 2022
1 parent eecc637 commit de47452
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions bytesconv_test.go
Expand Up @@ -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()

Expand Down

0 comments on commit de47452

Please sign in to comment.