summaryrefslogtreecommitdiff
path: root/gemini/request_test.go
diff options
context:
space:
mode:
authortjpcc <tjp@ctrl-c.club>2023-01-11 11:41:07 -0700
committertjpcc <tjp@ctrl-c.club>2023-01-11 11:41:07 -0700
commit4969e33e28e09581a3b380dec7ebdc8594d67838 (patch)
tree3fe162f05aad5df87d64f3117ab3af2e433fab41 /gemini/request_test.go
parente183f9cd23380a81071c32f64c91e60f46a7d8cb (diff)
WIP improve test coverage
There is a test of Response.Read that is failing and I haven't yet figured out why.
Diffstat (limited to 'gemini/request_test.go')
-rw-r--r--gemini/request_test.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/gemini/request_test.go b/gemini/request_test.go
index 1da24f7..c23d54b 100644
--- a/gemini/request_test.go
+++ b/gemini/request_test.go
@@ -3,6 +3,7 @@ package gemini_test
import (
"bytes"
"testing"
+ "net/url"
"tildegit.org/tjp/gus/gemini"
)
@@ -84,3 +85,19 @@ func TestParseRequest(t *testing.T) {
})
}
}
+
+func TestUnescapedQuery(t *testing.T) {
+ table := []string{
+ "foo bar",
+ }
+
+ for _, test := range table {
+ t.Run(test, func(t *testing.T) {
+ u, _ := url.Parse("gemini://domain.com/path?" + url.QueryEscape(test))
+ result := gemini.Request{ URL: u }.UnescapedQuery()
+ if result != test {
+ t.Errorf("expected %q, got %q", test, result)
+ }
+ })
+ }
+}