iso639/iso_639-2t_test.go

34 lines
657 B
Go
Raw Permalink Normal View History

2023-10-01 08:51:38 +02:00
package iso639
import "testing"
func TestGetISO639_2TCodeForLanguageName(t *testing.T) {
data := map[string]string{
"Bosnian": "bos",
"French": "fra",
"Italian": "ita",
}
for code, name := range data {
result, _ := GetISO639_2TCodeForLanguageName(code)
if result != name {
t.Errorf("got %q, wanted %q", result, name)
}
}
}
func TestGetLanguageNameForISO639_2TCodee(t *testing.T) {
data := map[string]string{
"heb": "Hebrew",
"ido": "Ido",
"ukr": "Ukrainian",
}
for code, name := range data {
result, _ := GetLanguageNameForISO639_2TCode(code)
if result != name {
t.Errorf("got %q, wanted %q", result, name)
}
}
}