git.spec: Workaround localized messages not put in any RPM
[git/mingw.git] / t / t0201-gettext-fallbacks.sh
blob52b1c27c2c9d3c6111447df4fa241b724f0e6ee1
1 #!/bin/sh
3 # Copyright (c) 2010 Ævar Arnfjörð Bjarmason
6 test_description='Gettext Shell fallbacks'
8 GIT_INTERNAL_GETTEXT_TEST_FALLBACKS=YesPlease
9 export GIT_INTERNAL_GETTEXT_TEST_FALLBACKS
11 . ./lib-gettext.sh
13 test_expect_success "sanity: \$GIT_INTERNAL_GETTEXT_SH_SCHEME is set (to $GIT_INTERNAL_GETTEXT_SH_SCHEME)" '
14 test -n "$GIT_INTERNAL_GETTEXT_SH_SCHEME"
17 test_expect_success 'sanity: $GIT_INTERNAL_GETTEXT_TEST_FALLBACKS is set' '
18 test -n "$GIT_INTERNAL_GETTEXT_TEST_FALLBACKS"
21 test_expect_success C_LOCALE_OUTPUT 'sanity: $GIT_INTERNAL_GETTEXT_SH_SCHEME" is fallthrough' '
22 echo fallthrough >expect &&
23 echo $GIT_INTERNAL_GETTEXT_SH_SCHEME >actual &&
24 test_cmp expect actual
27 test_expect_success 'gettext: our gettext() fallback has pass-through semantics' '
28 printf "test" >expect &&
29 gettext "test" >actual &&
30 test_i18ncmp expect actual &&
31 printf "test more words" >expect &&
32 gettext "test more words" >actual &&
33 test_i18ncmp expect actual
36 test_expect_success 'eval_gettext: our eval_gettext() fallback has pass-through semantics' '
37 printf "test" >expect &&
38 eval_gettext "test" >actual &&
39 test_i18ncmp expect actual &&
40 printf "test more words" >expect &&
41 eval_gettext "test more words" >actual &&
42 test_i18ncmp expect actual
45 test_expect_success 'eval_gettext: our eval_gettext() fallback can interpolate variables' '
46 printf "test YesPlease" >expect &&
47 GIT_INTERNAL_GETTEXT_TEST_FALLBACKS=YesPlease eval_gettext "test \$GIT_INTERNAL_GETTEXT_TEST_FALLBACKS" >actual &&
48 test_i18ncmp expect actual
51 test_expect_success 'eval_gettext: our eval_gettext() fallback can interpolate variables with spaces' '
52 cmdline="git am" &&
53 export cmdline;
54 printf "When you have resolved this problem run git am --resolved." >expect &&
55 eval_gettext "When you have resolved this problem run \$cmdline --resolved." >actual
56 test_i18ncmp expect actual
59 test_expect_success 'eval_gettext: our eval_gettext() fallback can interpolate variables with spaces and quotes' '
60 cmdline="git am" &&
61 export cmdline;
62 printf "When you have resolved this problem run \"git am --resolved\"." >expect &&
63 eval_gettext "When you have resolved this problem run \"\$cmdline --resolved\"." >actual
64 test_i18ncmp expect actual
67 test_done