diff options
author | José Carlos <jose.carlos@menteslibres.net> | 2016-08-30 17:04:31 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-30 17:04:31 -0500 |
commit | 74466a0a0c4a62fea38f44aa161d4bbfbe79dd6b (patch) | |
tree | a8881dcff5a38410048577e3c579ed20a26fa3bc | |
parent | Merge pull request #10 from mvo5/feature/travis (diff) | |
parent | fix tests on ubuntu (diff) | |
download | gotext-74466a0a0c4a62fea38f44aa161d4bbfbe79dd6b.tar.gz gotext-74466a0a0c4a62fea38f44aa161d4bbfbe79dd6b.tar.xz |
Merge pull request #11 from mvo5/bugfix/fix-tests-on-linux
Bugfix/fix tests on linux
-rw-r--r-- | gettext_test.go | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/gettext_test.go b/gettext_test.go index 6c58ab3..a22bbc6 100644 --- a/gettext_test.go +++ b/gettext_test.go @@ -1,6 +1,7 @@ package gettext import ( + "os" "testing" "github.com/stretchr/testify/assert" @@ -12,13 +13,16 @@ const ( frenchFrance = "fr_FR.utf8" ) -func TestSpanish(t *testing.T) { - SetLocale(LcAll, spanishMexico) - +// a setUp would be nice +func init() { textDomain := "example" - BindTextdomain(textDomain, "_examples/") Textdomain(textDomain) +} + +func TestSpanish(t *testing.T) { + os.Setenv("LANGUAGE", spanishMexico) + SetLocale(LcAll, "") assert.Equal(t, "¡Hola mundo!", Gettext("Hello, world!")) @@ -32,7 +36,8 @@ func TestSpanish(t *testing.T) { } func TestDeutsch(t *testing.T) { - SetLocale(LcAll, deutschDeutschland) + os.Setenv("LANGUAGE", deutschDeutschland) + SetLocale(LcAll, "") assert.Equal(t, "Hallo, Welt!", Gettext("Hello, world!")) @@ -47,8 +52,8 @@ func TestDeutsch(t *testing.T) { func TestFrench(t *testing.T) { // Note that we don't have a french translation. - - SetLocale(LcAll, frenchFrance) + os.Setenv("LANGUAGE", frenchFrance) + SetLocale(LcAll, "") assert.Equal(t, "Hello, world!", Gettext("Hello, world!")) |