aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Vogt <mvo@ubuntu.com>2016-03-09 10:48:44 +0100
committerMichael Vogt <mvo@ubuntu.com>2016-03-09 10:48:44 +0100
commitb70a3d8b623e95abffb21d5f5e6f2ac5e877e3f5 (patch)
treea8881dcff5a38410048577e3c579ed20a26fa3bc
parentadd travis.yml (diff)
downloadgotext-b70a3d8b623e95abffb21d5f5e6f2ac5e877e3f5.tar.gz
gotext-b70a3d8b623e95abffb21d5f5e6f2ac5e877e3f5.tar.xz
fix tests on ubuntu
-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!"))