| 1 | package colltabscip-go gomod golang.org/x/text . `golang.org/x/text/internal/colltab`/ |
| 2 | |
| 3 | import ( |
| 4 | "testingscip-go gomod github.com/golang/go/src go1.25.0 testing/" |
| 5 | |
| 6 | "golang.org/x/text/languagescip-go gomod golang.org/x/text . `golang.org/x/text/language`/" |
| 7 | ) |
| 8 | |
| 9 | func TestMatchLangscip-go gomod golang.org/x/text . `golang.org/x/text/internal/colltab`/TestMatchLang().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 10 | tags := []languagescip-go gomod golang.org/x/text . `golang.org/x/text/language`/.Tagscip-go gomod golang.org/x/text . `golang.org/x/text/language`/Tag#{ |
| 11 | 0: languagescip-go gomod golang.org/x/text . `golang.org/x/text/language`/.Undscip-go gomod golang.org/x/text . `golang.org/x/text/language`/Und., |
| 12 | 1: languagescip-go gomod golang.org/x/text . `golang.org/x/text/language`/.MustParsescip-go gomod golang.org/x/text . `golang.org/x/text/language`/MustParse().("bs"), |
| 13 | 2: languagescip-go gomod golang.org/x/text . `golang.org/x/text/language`/.Germanscip-go gomod golang.org/x/text . `golang.org/x/text/language`/German., |
| 14 | 3: languagescip-go gomod golang.org/x/text . `golang.org/x/text/language`/.Englishscip-go gomod golang.org/x/text . `golang.org/x/text/language`/English., |
| 15 | 4: languagescip-go gomod golang.org/x/text . `golang.org/x/text/language`/.AmericanEnglishscip-go gomod golang.org/x/text . `golang.org/x/text/language`/AmericanEnglish., |
| 16 | 5: languagescip-go gomod golang.org/x/text . `golang.org/x/text/language`/.MustParsescip-go gomod golang.org/x/text . `golang.org/x/text/language`/MustParse().("en-US-u-va-posix"), |
| 17 | 6: languagescip-go gomod golang.org/x/text . `golang.org/x/text/language`/.Portuguesescip-go gomod golang.org/x/text . `golang.org/x/text/language`/Portuguese., |
| 18 | 7: languagescip-go gomod golang.org/x/text . `golang.org/x/text/language`/.Serbianscip-go gomod golang.org/x/text . `golang.org/x/text/language`/Serbian., |
| 19 | 8: languagescip-go gomod golang.org/x/text . `golang.org/x/text/language`/.MustParsescip-go gomod golang.org/x/text . `golang.org/x/text/language`/MustParse().("sr-Latn"), |
| 20 | 9: languagescip-go gomod golang.org/x/text . `golang.org/x/text/language`/.Chinesescip-go gomod golang.org/x/text . `golang.org/x/text/language`/Chinese., |
| 21 | 10: languagescip-go gomod golang.org/x/text . `golang.org/x/text/language`/.MustParsescip-go gomod golang.org/x/text . `golang.org/x/text/language`/MustParse().("zh-u-co-stroke"), |
| 22 | 11: languagescip-go gomod golang.org/x/text . `golang.org/x/text/language`/.MustParsescip-go gomod golang.org/x/text . `golang.org/x/text/language`/MustParse().("zh-Hant-u-co-pinyin"), |
| 23 | 12: languagescip-go gomod golang.org/x/text . `golang.org/x/text/language`/.TraditionalChinesescip-go gomod golang.org/x/text . `golang.org/x/text/language`/TraditionalChinese., |
| 24 | } |
| 25 | for i, tc := range []struct { |
| 26 | x int |
| 27 | t languagescip-go gomod golang.org/x/text . `golang.org/x/text/language`/.Tagscip-go gomod golang.org/x/text . `golang.org/x/text/language`/Tag# |
| 28 | }{ |
| 29 | {0, languagescip-go gomod golang.org/x/text . `golang.org/x/text/language`/.Undscip-go gomod golang.org/x/text . `golang.org/x/text/language`/Und.}, |
| 30 | {0, languagescip-go gomod golang.org/x/text . `golang.org/x/text/language`/.Persianscip-go gomod golang.org/x/text . `golang.org/x/text/language`/Persian.}, // Default to first element when no match. |
| 31 | {3, languagescip-go gomod golang.org/x/text . `golang.org/x/text/language`/.Englishscip-go gomod golang.org/x/text . `golang.org/x/text/language`/English.}, |
| 32 | {4, languagescip-go gomod golang.org/x/text . `golang.org/x/text/language`/.AmericanEnglishscip-go gomod golang.org/x/text . `golang.org/x/text/language`/AmericanEnglish.}, |
| 33 | {5, languagescip-go gomod golang.org/x/text . `golang.org/x/text/language`/.MustParsescip-go gomod golang.org/x/text . `golang.org/x/text/language`/MustParse().("en-US-u-va-posix")}, // Ext. variant match. |
| 34 | {4, languagescip-go gomod golang.org/x/text . `golang.org/x/text/language`/.MustParsescip-go gomod golang.org/x/text . `golang.org/x/text/language`/MustParse().("en-US-u-va-noposix")}, // Ext. variant mismatch. |
| 35 | {3, languagescip-go gomod golang.org/x/text . `golang.org/x/text/language`/.MustParsescip-go gomod golang.org/x/text . `golang.org/x/text/language`/MustParse().("en-UK-u-va-noposix")}, // Ext. variant mismatch. |
| 36 | {7, languagescip-go gomod golang.org/x/text . `golang.org/x/text/language`/.Serbianscip-go gomod golang.org/x/text . `golang.org/x/text/language`/Serbian.}, |
| 37 | {0, languagescip-go gomod golang.org/x/text . `golang.org/x/text/language`/.Croatianscip-go gomod golang.org/x/text . `golang.org/x/text/language`/Croatian.}, // Don't match to close language! |
| 38 | {0, languagescip-go gomod golang.org/x/text . `golang.org/x/text/language`/.MustParsescip-go gomod golang.org/x/text . `golang.org/x/text/language`/MustParse().("gsw")}, // Don't match to close language! |
| 39 | {1, languagescip-go gomod golang.org/x/text . `golang.org/x/text/language`/.MustParsescip-go gomod golang.org/x/text . `golang.org/x/text/language`/MustParse().("bs-Cyrl")}, // Odd, but correct. |
| 40 | {1, languagescip-go gomod golang.org/x/text . `golang.org/x/text/language`/.MustParsescip-go gomod golang.org/x/text . `golang.org/x/text/language`/MustParse().("bs-Latn")}, // Estimated script drops. |
| 41 | {8, languagescip-go gomod golang.org/x/text . `golang.org/x/text/language`/.MustParsescip-go gomod golang.org/x/text . `golang.org/x/text/language`/MustParse().("sr-Latn")}, |
| 42 | {9, languagescip-go gomod golang.org/x/text . `golang.org/x/text/language`/.Chinesescip-go gomod golang.org/x/text . `golang.org/x/text/language`/Chinese.}, |
| 43 | {9, languagescip-go gomod golang.org/x/text . `golang.org/x/text/language`/.SimplifiedChinesescip-go gomod golang.org/x/text . `golang.org/x/text/language`/SimplifiedChinese.}, |
| 44 | {12, languagescip-go gomod golang.org/x/text . `golang.org/x/text/language`/.TraditionalChinesescip-go gomod golang.org/x/text . `golang.org/x/text/language`/TraditionalChinese.}, |
| 45 | {11, languagescip-go gomod golang.org/x/text . `golang.org/x/text/language`/.MustParsescip-go gomod golang.org/x/text . `golang.org/x/text/language`/MustParse().("zh-Hant-u-co-pinyin")}, |
| 46 | // TODO: should this be 12? Either inherited value (10) or default is |
| 47 | // fine in this case, though. Other locales are not affected. |
| 48 | {10, languagescip-go gomod golang.org/x/text . `golang.org/x/text/language`/.MustParsescip-go gomod golang.org/x/text . `golang.org/x/text/language`/MustParse().("zh-Hant-u-co-stroke")}, |
| 49 | // There is no "phonebk" sorting order for zh-Hant, so use default. |
| 50 | {12, languagescip-go gomod golang.org/x/text . `golang.org/x/text/language`/.MustParsescip-go gomod golang.org/x/text . `golang.org/x/text/language`/MustParse().("zh-Hant-u-co-phonebk")}, |
| 51 | {10, languagescip-go gomod golang.org/x/text . `golang.org/x/text/language`/.MustParsescip-go gomod golang.org/x/text . `golang.org/x/text/language`/MustParse().("zh-u-co-stroke")}, |
| 52 | {12, languagescip-go gomod golang.org/x/text . `golang.org/x/text/language`/.MustParsescip-go gomod golang.org/x/text . `golang.org/x/text/language`/MustParse().("und-TW")}, // Infer script and language. |
| 53 | {12, languagescip-go gomod golang.org/x/text . `golang.org/x/text/language`/.MustParsescip-go gomod golang.org/x/text . `golang.org/x/text/language`/MustParse().("und-HK")}, // Infer script and language. |
| 54 | {6, languagescip-go gomod golang.org/x/text . `golang.org/x/text/language`/.MustParsescip-go gomod golang.org/x/text . `golang.org/x/text/language`/MustParse().("und-BR")}, // Infer script and language. |
| 55 | {6, languagescip-go gomod golang.org/x/text . `golang.org/x/text/language`/.MustParsescip-go gomod golang.org/x/text . `golang.org/x/text/language`/MustParse().("und-PT")}, // Infer script and language. |
| 56 | {2, languagescip-go gomod golang.org/x/text . `golang.org/x/text/language`/.MustParsescip-go gomod golang.org/x/text . `golang.org/x/text/language`/MustParse().("und-Latn-DE")}, // Infer language. |
| 57 | {0, languagescip-go gomod golang.org/x/text . `golang.org/x/text/language`/.MustParsescip-go gomod golang.org/x/text . `golang.org/x/text/language`/MustParse().("und-Jpan-BR")}, // Infers "ja", so no match. |
| 58 | {0, languagescip-go gomod golang.org/x/text . `golang.org/x/text/language`/.MustParsescip-go gomod golang.org/x/text . `golang.org/x/text/language`/MustParse().("zu")}, // No match past index. |
| 59 | } { |
| 60 | t.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Run().(tc.t.Stringscip-go gomod golang.org/x/text . `golang.org/x/text/language`/Tag#String().(), func(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 61 | if x := MatchLangscip-go gomod golang.org/x/text . `golang.org/x/text/internal/colltab`/MatchLang().(tc.t, tags); x != tc.x { |
| 62 | t.Errorfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Errorf().("%d: MatchLang(%q, tags) = %d; want %d", i, tc.t, x, tc.x) |
| 63 | } |
| 64 | }) |
| 65 | } |
| 66 | } |