package gemini import ( "strconv" "testing" ) func TestParse(t *testing.T) { tables := []struct { 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 := Parse("", table.host, table.port) if err != nil { t.Fatalf("NewGeminiConn error: %s", err.Error()) } if conn.host != table.url { t.Fatalf("NewGeminiConn error: wrong hostname %s", conn.host) } } }