24 lines
498 B
Go
24 lines
498 B
Go
package iso639
|
|
|
|
import "testing"
|
|
|
|
func TestGetLanguageNameForISO639Code(t *testing.T) {
|
|
data := map[string]string{
|
|
"nl": "Dutch", // ISO 639-1
|
|
"nld": "Dutch", // ISO 639-2/B
|
|
"dut": "Dutch", // ISO 639-2/T
|
|
"NL": "",
|
|
"NLD": "",
|
|
"DUT": "",
|
|
"gfedgjhgrh": "",
|
|
"GIJGKDJ": "",
|
|
}
|
|
|
|
for code, name := range data {
|
|
result, _ := GetLanguageNameForISO639Code(code)
|
|
if result != name {
|
|
t.Errorf("got %q, wanted %q", result, name)
|
|
}
|
|
}
|
|
}
|