34 lines
657 B
Go
34 lines
657 B
Go
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)
|
|
}
|
|
}
|
|
}
|