aboutsummaryrefslogtreecommitdiff
path: root/gettext_test.go
diff options
context:
space:
mode:
authorJosé Carlos <jose.carlos@menteslibres.net>2016-08-30 17:04:31 -0500
committerGitHub <noreply@github.com>2016-08-30 17:04:31 -0500
commit74466a0a0c4a62fea38f44aa161d4bbfbe79dd6b (patch)
treea8881dcff5a38410048577e3c579ed20a26fa3bc /gettext_test.go
parentMerge pull request #10 from mvo5/feature/travis (diff)
parentfix tests on ubuntu (diff)
downloadgotext-74466a0a0c4a62fea38f44aa161d4bbfbe79dd6b.tar.gz
gotext-74466a0a0c4a62fea38f44aa161d4bbfbe79dd6b.tar.xz
Merge pull request #11 from mvo5/bugfix/fix-tests-on-linux
Bugfix/fix tests on linux
Diffstat (limited to 'gettext_test.go')
-rw-r--r--gettext_test.go19
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!"))