Code

gettext tests: add GETTEXT_POISON tests for shell scripts
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Tue, 7 Sep 2010 15:38:23 +0000 (15:38 +0000)
committerÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Sat, 30 Oct 2010 07:58:15 +0000 (07:58 +0000)
Test the new GETTEXT_POISON=YesPlease support for shell scripts. This
test is derived from the existing t0201-gettext-fallbacks.sh test.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
t/t0205-gettext-poison.sh [new file with mode: 0755]
t/test-lib.sh

diff --git a/t/t0205-gettext-poison.sh b/t/t0205-gettext-poison.sh
new file mode 100755 (executable)
index 0000000..2361590
--- /dev/null
@@ -0,0 +1,36 @@
+#!/bin/sh
+#
+# Copyright (c) 2010 Ævar Arnfjörð Bjarmason
+#
+
+test_description='Gettext Shell poison'
+
+. ./lib-gettext.sh
+
+test_expect_success GETTEXT_POISON "sanity: \$GIT_INTERNAL_GETTEXT_SH_SCHEME is set (to $GIT_INTERNAL_GETTEXT_SH_SCHEME)" '
+    test -n "$GIT_INTERNAL_GETTEXT_SH_SCHEME"
+'
+
+test_expect_success GETTEXT_POISON 'sanity: $GIT_INTERNAL_GETTEXT_SH_SCHEME" is poison' '
+    test "$GIT_INTERNAL_GETTEXT_SH_SCHEME" = "poison"
+'
+
+test_expect_success GETTEXT_POISON 'gettext: our gettext() fallback has poison semantics' '
+    printf "# GETTEXT POISON #" >expect &&
+    gettext "test" >actual &&
+    test_cmp expect actual &&
+    printf "# GETTEXT POISON #" >expect &&
+    gettext "test more words" >actual &&
+    test_cmp expect actual
+'
+
+test_expect_success GETTEXT_POISON 'eval_gettext: our eval_gettext() fallback has poison semantics' '
+    printf "# GETTEXT POISON #" >expect &&
+    eval_gettext "test" >actual &&
+    test_cmp expect actual &&
+    printf "# GETTEXT POISON #" >expect &&
+    eval_gettext "test more words" >actual &&
+    test_cmp expect actual
+'
+
+test_done
index c243f0d18f334779a47093acabab793791f8403d..11d434417bf9420f443a0ce850e9b456cd1a7eb8 100644 (file)
@@ -988,6 +988,7 @@ if test -z "$GETTEXT_POISON"
 then
        test_set_prereq NO_GETTEXT_POISON
 else
+       test_set_prereq GETTEXT_POISON
        GIT_INTERNAL_GETTEXT_GETTEXT_POISON=YesPlease
        export GIT_INTERNAL_GETTEXT_GETTEXT_POISON
 fi