diff options
author | Erik Dubbelboer <erik@dubbelboer.com> | 2020-12-26 16:53:48 +0100 |
---|---|---|
committer | Erik Dubbelboer <erik@dubbelboer.com> | 2020-12-26 16:53:48 +0100 |
commit | 4e63057c0fd0ebcc9040c161ad69c7e56d57cf82 (patch) | |
tree | 0005e491ad96ea940e27f3ff64b822e333e60c93 /args_test.go | |
parent | fix issue #875 (#909) (diff) | |
download | fasthttp-4e63057c0fd0ebcc9040c161ad69c7e56d57cf82.tar.gz fasthttp-4e63057c0fd0ebcc9040c161ad69c7e56d57cf82.tar.bz2 fasthttp-4e63057c0fd0ebcc9040c161ad69c7e56d57cf82.zip |
Make argsKV more predictable
Fixes #932
Diffstat (limited to 'args_test.go')
-rw-r--r-- | args_test.go | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/args_test.go b/args_test.go index b2e1954..c780c3b 100644 --- a/args_test.go +++ b/args_test.go @@ -596,4 +596,28 @@ func TestArgsDeleteAll(t *testing.T) { if a.Len() != 1 || a.Has("q1") { t.Fatalf("Expected q1 arg to be completely deleted. Current Args: %s", a.String()) } -}
\ No newline at end of file +} + +func TestIssue932(t *testing.T) { + t.Parallel() + var a []argsKV + + a = setArg(a, "t1", "ok", argsHasValue) + a = setArg(a, "t2", "", argsHasValue) + a = setArg(a, "t1", "", argsHasValue) + a = setArgBytes(a, s2b("t3"), []byte{}, argsHasValue) + a = setArgBytes(a, s2b("t4"), nil, argsHasValue) + + if peekArgStr(a, "t1") == nil { + t.Error("nil not expected for t1") + } + if peekArgStr(a, "t2") == nil { + t.Error("nil not expected for t2") + } + if peekArgStr(a, "t3") == nil { + t.Error("nil not expected for t3") + } + if peekArgStr(a, "t4") != nil { + t.Error("nil expected for t4") + } +} |