diff options
author | aqua <aqua@iserlohn-fortress.net> | 2021-08-04 11:57:26 +0300 |
---|---|---|
committer | aqua <aqua@iserlohn-fortress.net> | 2021-08-04 11:57:26 +0300 |
commit | 479cd8d24eda5edf63235210112e4c5ddfa6f370 (patch) | |
tree | a771e6c1c988f7f6539927bee16d8b27b53f5422 /gemini_test.go | |
parent | gemcat can now do multiple requests at once (diff) | |
download | gemcat-479cd8d24eda5edf63235210112e4c5ddfa6f370.tar.xz |
Move gemini code into its own module
Diffstat (limited to 'gemini_test.go')
-rw-r--r-- | gemini_test.go | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/gemini_test.go b/gemini_test.go deleted file mode 100644 index efa34b9..0000000 --- a/gemini_test.go +++ /dev/null @@ -1,43 +0,0 @@ -package main - -import ( - "bytes" - "strconv" - "testing" -) - -func TestNewGeminiConn(t *testing.T) { - tables := []struct { - url string - port int - host 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) - if err != nil { - t.Fatalf("NewGeminiConn error: %s", err.Error()) - } - if conn.host != table.host { - 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) - } - } -} |