Better error handling, many fixes all around
This commit is contained in:
@@ -21,7 +21,31 @@ func TestGetMimeTypeAndLang11(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetMimeTypeAndLang12(t *testing.T) {
|
||||
t.Parallel()
|
||||
code, mimeType, lang := getMimeTypeAndLang("20 text/plain; charset=utf-8")
|
||||
if code != 20 || mimeType != "text/plain" || lang != "utf-8" {
|
||||
t.Errorf("Expected (20, 'text/plain', ''), got (%d, '%s', '%s')", code, mimeType, lang)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetMimeTypeAndLang13(t *testing.T) {
|
||||
t.Parallel()
|
||||
code, mimeType, lang := getMimeTypeAndLang("20 text/gemini; charset=utf-8")
|
||||
if code != 20 || mimeType != "text/gemini" || lang != "utf-8" {
|
||||
t.Errorf("Expected (20, 'text/plain', ''), got (%d, '%s', '%s')", code, mimeType, lang)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetTypeAndLang2(t *testing.T) {
|
||||
t.Parallel()
|
||||
code, mimeType, lang := getMimeTypeAndLang("20 text/gemini charset=en")
|
||||
if code != 20 || mimeType != "text/gemini" || lang != "en" {
|
||||
t.Errorf("Expected (20, 'text/gemini', 'en'), got (%d, '%s', '%s')", code, mimeType, lang)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetTypeAndLang21(t *testing.T) {
|
||||
t.Parallel()
|
||||
code, mimeType, lang := getMimeTypeAndLang("20 text/gemini lang=en")
|
||||
if code != 20 || mimeType != "text/gemini" || lang != "en" {
|
||||
|
||||
Reference in New Issue
Block a user