diff options
author | aqua <aqua@iserlohn-fortress.net> | 2021-08-04 14:47:31 +0300 |
---|---|---|
committer | aqua <aqua@iserlohn-fortress.net> | 2021-08-04 14:47:31 +0300 |
commit | 7808fc925434b22e5d40cc16efa637795e458b5b (patch) | |
tree | d7512adb4338c4feb9c577e249d8fb34f3b46eb4 /gemini/gemini_test.go | |
parent | Move gemini code into its own module (diff) | |
download | gemcat-7808fc925434b22e5d40cc16efa637795e458b5b.tar.xz |
Rename GeminiConn to GeminiURI
Diffstat (limited to 'gemini/gemini_test.go')
-rw-r--r-- | gemini/gemini_test.go | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/gemini/gemini_test.go b/gemini/gemini_test.go index ffd2588..1d69498 100644 --- a/gemini/gemini_test.go +++ b/gemini/gemini_test.go @@ -1,43 +1,28 @@ package gemini import ( - "bytes" "strconv" "testing" ) -func TestNewGeminiConn(t *testing.T) { +func TestParse(t *testing.T) { tables := []struct { - url string - port int host string + port int + url string }{ {"hostname.com", GeminiPort, "hostname.com:" + strconv.Itoa(GeminiPort)}, {"hostname.com", 1234, "hostname.com:1234"}, } for _, table := range tables { - conn, err := NewGeminiConnFromRequest(table.url, table.port) + conn, err := Parse("", table.host, table.port) if err != nil { t.Fatalf("NewGeminiConn error: %s", err.Error()) } - if conn.host != table.host { + if conn.host != table.url { t.Fatalf("NewGeminiConn error: wrong hostname %s", conn.host) } } } -func TestFormatRequest(t *testing.T) { - tables := []struct { - input string - output []byte - }{ - {"hostname.com", []byte("gemini://hostname.com\r\n")}, - } - - for _, table := range tables { - if !bytes.Equal(FormatRequest(table.input), table.output) { - t.Fatalf("FormatRequest failed on: %s\n", table.input) - } - } -} |