package braille import ( "os" "path/filepath" "testing" ) func TestTablesForLocaleIncludesUSEnglishAndUEB(t *testing.T) { dir := t.TempDir() for _, name := range []string{"en-us-g1.ctb", "en-us-g2.ctb", "en-ueb-g2.ctb", "en-us-interline.ctb", "en-gb-g1.utb", "fr-fr-g2.ctb"} { if err := os.WriteFile(filepath.Join(dir, name), nil, 0600); err != nil { t.Fatal(err) } } options := tablesForLocale(dir, "en_US.UTF-8") if len(options) != 3 || options[0].Label != "en-ueb Grade 2" || options[2].File != filepath.Join(dir, "en-us-g2.ctb") { t.Fatalf("US tables = %+v", options) } if options = tablesForLocale(dir, "fr_FR.UTF-8"); len(options) != 1 || options[0].Label != "fr-fr Grade 2" { t.Fatalf("French tables = %+v", options) } }