36 lines
653 B
Go
36 lines
653 B
Go
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)
|
|
}
|
|
}
|
|
}
|