Merge branch 'master' of git://repo.or.cz/alt-git
[git/mingw.git] / t / t0201-gettext-fallbacks.sh
blob54d98b9b109441025b9b61c2964e29895eb360b7
1 #!/bin/sh
3 # Copyright (c) 2010 Ævar Arnfjörð Bjarmason
6 test_description='Gettext Shell fallbacks'
8 . ./test-lib.sh
9 . "$GIT_BUILD_DIR"/git-sh-i18n
11 test_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
20 test_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
29 test_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
35 test_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
43 test_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
51 test_done