1#!/bin/sh
2#
3# Copyright (c) 2010 Ævar Arnfjörð Bjarmason
4#
5
6test_description='Gettext Shell fallbacks'
7
8. ./test-lib.sh
9. "$GIT_BUILD_DIR"/git-sh-i18n
10
11test_expect_success 'gettext: our gettext() fallback has pass-through semantics' '
12 printf "test" >expect &&
13 gettext "test" >actual &&
14 test_i18ncmp expect actual &&
15 printf "test more words" >expect &&
16 gettext "test more words" >actual &&
17 test_i18ncmp expect actual
18'
19
20test_expect_success 'eval_gettext: our eval_gettext() fallback has pass-through semantics' '
21 printf "test" >expect &&
22 eval_gettext "test" >actual &&
23 test_i18ncmp expect actual &&
24 printf "test more words" >expect &&
25 eval_gettext "test more words" >actual &&
26 test_i18ncmp expect actual
27'
28
29test_expect_success 'eval_gettext: our eval_gettext() fallback can interpolate variables' '
30 printf "test YesPlease" >expect &&
31 GIT_INTERNAL_GETTEXT_TEST_FALLBACKS=YesPlease eval_gettext "test \$GIT_INTERNAL_GETTEXT_TEST_FALLBACKS" >actual &&
32 test_i18ncmp expect actual
33'
34
35test_expect_success 'eval_gettext: our eval_gettext() fallback can interpolate variables with spaces' '
36 cmdline="git am" &&
37 export cmdline;
38 printf "When you have resolved this problem run git am --resolved." >expect &&
39 eval_gettext "When you have resolved this problem run \$cmdline --resolved." >actual
40 test_i18ncmp expect actual
41'
42
43test_expect_success 'eval_gettext: our eval_gettext() fallback can interpolate variables with spaces and quotes' '
44 cmdline="git am" &&
45 export cmdline;
46 printf "When you have resolved this problem run \"git am --resolved\"." >expect &&
47 eval_gettext "When you have resolved this problem run \"\$cmdline --resolved\"." >actual
48 test_i18ncmp expect actual
49'
50
51test_done