iso639/iso_639-2b_test.go

36 lines
688 B
Go
Raw Permalink Normal View History

2023-10-01 08:51:38 +02:00
package iso639
import (
"testing"
)
func TestGetISO639_2BCodeForLanguageName(t *testing.T) {
data := map[string]string{
"Azerbaijani": "aze",
"Hindi": "hin",
"Norwegian Bokmål": "nob",
}
for code, name := range data {
result, _ := GetISO639_2BCodeForLanguageName(code)
if result != name {
t.Errorf("got %q, wanted %q", result, name)
}
}
}
func TestGetLanguageNameForISO639_2BCode(t *testing.T) {
data := map[string]string{
"che": "Chechen",
"gle": "Irish",
"mao": "Maori",
}
for code, name := range data {
result, _ := GetLanguageNameForISO639_2BCode(code)
if result != name {
t.Errorf("got %q, wanted %q", result, name)
}
}
}