diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-03-07 06:47:23 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-07 06:47:23 -0800 |
commit | 153cf39b520f2b6eb6d2c250ab5edf58e1db4a6a (patch) | |
tree | e79fab70c9094d34ffd28e767b3a5641059d04cb /libpod/container_internal_test.go | |
parent | bf21ec8520bb429e9b1514422d9bc0b3426f4391 (diff) | |
parent | 69cb8639b406a6bd4b441073fcb27dc68be01fe8 (diff) | |
download | podman-153cf39b520f2b6eb6d2c250ab5edf58e1db4a6a.tar.gz podman-153cf39b520f2b6eb6d2c250ab5edf58e1db4a6a.tar.bz2 podman-153cf39b520f2b6eb6d2c250ab5edf58e1db4a6a.zip |
Merge pull request #2550 from wking/language-dot-split
libpod/container_internal: Split locale at the first dot, etc.
Diffstat (limited to 'libpod/container_internal_test.go')
-rw-r--r-- | libpod/container_internal_test.go | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/libpod/container_internal_test.go b/libpod/container_internal_test.go index f1e2b70a7..1654af929 100644 --- a/libpod/container_internal_test.go +++ b/libpod/container_internal_test.go @@ -17,6 +17,54 @@ import ( // hookPath is the path to an example hook executable. var hookPath string +func TestLocaleToLanguage(t *testing.T) { + for _, testCase := range []struct { + locale string + language string + }{ + { + locale: "", + language: "und-u-va-posix", + }, + { + locale: "C", + language: "und-u-va-posix", + }, + { + locale: "POSIX", + language: "und-u-va-posix", + }, + { + locale: "c", + language: "und-u-va-posix", + }, + { + locale: "en", + language: "en", + }, + { + locale: "en_US", + language: "en-US", + }, + { + locale: "en.UTF-8", + language: "en", + }, + { + locale: "en_US.UTF-8", + language: "en-US", + }, + { + locale: "does-not-exist", + language: "does-not-exist", + }, + } { + t.Run(testCase.locale, func(t *testing.T) { + assert.Equal(t, testCase.language, localeToLanguage(testCase.locale)) + }) + } +} + func TestPostDeleteHooks(t *testing.T) { ctx := context.Background() dir, err := ioutil.TempDir("", "libpod_test_") |