iso639/iso_639-1_test.go

36 lines
653 B
Go
Raw Normal View History

2023-10-01 08:51:38 +02:00
package iso639
import (
"testing"
)
func TestGetISO639_1CodeForLanguageName(t *testing.T) {
data := map[string]string{
"Arabic": "ar",
"German": "de",
"Serbian": "sr",
}
for code, name := range data {
result, _ := GetISO639_1CodeForLanguageName(code)
if result != name {
t.Errorf("got %q, wanted %q", result, name)
}
}
}
func TestGetLanguageNameForISO639_1Code(t *testing.T) {
data := map[string]string{
"de": "German",
"en": "English",
"zh": "Chinese",
}
for code, name := range data {
result, _ := GetLanguageNameForISO639_1Code(code)
if result != name {
t.Errorf("got %q, wanted %q", result, name)
}
}
}