diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2023-03-20 13:01:48 +0100 |
|---|---|---|
| committer | Jeroen Wijenbergh <46386452+jwijenbergh@users.noreply.github.com> | 2023-09-25 09:43:37 +0200 |
| commit | 5d67ddd178649b2b7c59f738289c05c836366dba (patch) | |
| tree | 2c455c624ff93b69cae4ab56ebec0c6d137d6d4d /internal/util/util_test.go | |
| parent | 1ed2b34c3890fb4c7cd958f09b96adf3525eef55 (diff) | |
Util: Get rid of language matching
Diffstat (limited to 'internal/util/util_test.go')
| -rw-r--r-- | internal/util/util_test.go | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/internal/util/util_test.go b/internal/util/util_test.go index c3d1cee..5e19f57 100644 --- a/internal/util/util_test.go +++ b/internal/util/util_test.go @@ -65,47 +65,3 @@ func TestReplaceWAYF(t *testing.T) { t.Fatalf("Got: %s, want: %s", replaced, wantReplaced) } } - -func TestGetLanguageMatched(t *testing.T) { - // exact match - returned := GetLanguageMatched(map[string]string{"en": "test", "de": "test2"}, "en") - if returned != "test" { - t.Fatalf("Got: %s, want: %s", returned, "test") - } - - // starts with language tag - returned = GetLanguageMatched(map[string]string{"en-US-test": "test", "de": "test2"}, "en-US") - if returned != "test" { - t.Fatalf("Got: %s, want: %s", returned, "test") - } - - // starts with en- - returned = GetLanguageMatched(map[string]string{"en-UK": "test", "en": "test2"}, "en-US") - if returned != "test" { - t.Fatalf("Got: %s, want: %s", returned, "test") - } - - // exact match for en - returned = GetLanguageMatched(map[string]string{"de": "test", "en": "test2"}, "en-US") - if returned != "test2" { - t.Fatalf("Got: %s, want: %s", returned, "test2") - } - - // We default to english - returned = GetLanguageMatched(map[string]string{"es": "test", "en": "test2"}, "nl-NL") - if returned != "test2" { - t.Fatalf("Got: %s, want: %s", returned, "test2") - } - - // We default to english with a - as well - returned = GetLanguageMatched(map[string]string{"est": "test", "en-": "test2"}, "en-US") - if returned != "test2" { - t.Fatalf("Got: %s, want: %s", returned, "test2") - } - - // None found just return one - returned = GetLanguageMatched(map[string]string{"es": "test"}, "en-US") - if returned != "test" { - t.Fatalf("Got: %s, want: %s", returned, "test") - } -} |
