diff options
author | xuecai <bluesnow1st@sina.com> | 2019-01-04 23:38:56 +0800 |
---|---|---|
committer | Kirill Danshin <kirill@danshin.pro> | 2019-01-04 18:38:56 +0300 |
commit | c88be72d77e6deede478719f77f7b83df75531e8 (patch) | |
tree | 4403cd0dbc1ea42b292b62cac0ee78e2f4b73fc3 /args_test.go | |
parent | Add test for ConnState (diff) | |
download | fasthttp-c88be72d77e6deede478719f77f7b83df75531e8.tar.gz fasthttp-c88be72d77e6deede478719f77f7b83df75531e8.tar.bz2 fasthttp-c88be72d77e6deede478719f77f7b83df75531e8.zip |
* add method StringSort QueryStringSort AppendBytesSort in args
* simplify code
* only Sort method
* format
* add method StringSort QueryStringSort AppendBytesSort in args
* simplify code
* only Sort method
* format
* merge and fix tests
* change sort into generic by having the sort function
* change sort into generic by having the sort function
* change comment
Diffstat (limited to 'args_test.go')
-rw-r--r-- | args_test.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/args_test.go b/args_test.go index 2a5cb9a..db44750 100644 --- a/args_test.go +++ b/args_test.go @@ -1,6 +1,7 @@ package fasthttp import ( + "bytes" "fmt" "reflect" "strings" @@ -48,6 +49,13 @@ func TestArgsAdd(t *testing.T) { t.Fatalf("unexpected result: %q. Expecting %q", s, expectedS) } + a.Sort(bytes.Compare) + ss := a.String() + expectedSS := "ba=23&foo=&foo&foo=1&foo=bar&foo=baz" + if ss != expectedSS { + t.Fatalf("unexpected result: %q. Expecting %q", ss, expectedSS) + } + var a1 Args a1.Parse(s) if a1.Len() != 6 { |