summaryrefslogtreecommitdiff
path: root/internal/util/util_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/util/util_test.go')
-rw-r--r--internal/util/util_test.go44
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")
- }
-}