lang_test.go (309B)
1 package lang 2 3 import ( 4 "testing" 5 ) 6 7 func TestLang(t *testing.T) { 8 var err error 9 _, err = LanguageFromCode("xxx") 10 if err == nil { 11 t.Fatalf("expected error") 12 } 13 l, err := LanguageFromCode("en") 14 if err != nil { 15 t.Fatal(err) 16 } 17 if l.Code != "eng" { 18 t.Fatalf("expected 'eng', got '%s'", l.Code) 19 } 20 }