Merge branch 'ps/reflog-list' into HEAD
[alt-git.git] / t / t0201-gettext-fallbacks.sh
blob8724ce1052ddbf23ce421e15562c2416b2ea0ceb
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 TEST_PASSES_SANITIZE_LEAK=true
12 . ./lib-gettext.sh
14 test_expect_success "sanity: \$GIT_INTERNAL_GETTEXT_SH_SCHEME is set (to $GIT_INTERNAL_GETTEXT_SH_SCHEME)" '
15 test -n "$GIT_INTERNAL_GETTEXT_SH_SCHEME"
18 test_expect_success 'sanity: $GIT_INTERNAL_GETTEXT_TEST_FALLBACKS is set' '
19 test -n "$GIT_INTERNAL_GETTEXT_TEST_FALLBACKS"
22 test_expect_success 'sanity: $GIT_INTERNAL_GETTEXT_SH_SCHEME" is fallthrough' '
23 echo fallthrough >expect &&
24 echo $GIT_INTERNAL_GETTEXT_SH_SCHEME >actual &&
25 test_cmp expect actual
28 test_expect_success 'gettext: our gettext() fallback has pass-through semantics' '
29 printf "test" >expect &&
30 gettext "test" >actual &&
31 test_cmp expect actual &&
32 printf "test more words" >expect &&
33 gettext "test more words" >actual &&
34 test_cmp expect actual
37 test_expect_success 'eval_gettext: our eval_gettext() fallback has pass-through semantics' '
38 printf "test" >expect &&
39 eval_gettext "test" >actual &&
40 test_cmp expect actual &&
41 printf "test more words" >expect &&
42 eval_gettext "test more words" >actual &&
43 test_cmp expect actual
46 test_expect_success 'eval_gettext: our eval_gettext() fallback can interpolate variables' '
47 printf "test YesPlease" >expect &&
48 GIT_INTERNAL_GETTEXT_TEST_FALLBACKS=YesPlease eval_gettext "test \$GIT_INTERNAL_GETTEXT_TEST_FALLBACKS" >actual &&
49 test_cmp expect actual
52 test_expect_success 'eval_gettext: our eval_gettext() fallback can interpolate variables with spaces' '
53 cmdline="git am" &&
54 export cmdline &&
55 printf "When you have resolved this problem, run git am --resolved." >expect &&
56 eval_gettext "When you have resolved this problem, run \$cmdline --resolved." >actual &&
57 test_cmp expect actual
60 test_expect_success 'eval_gettext: our eval_gettext() fallback can interpolate variables with spaces and quotes' '
61 cmdline="git am" &&
62 export cmdline &&
63 printf "When you have resolved this problem, run \"git am --resolved\"." >expect &&
64 eval_gettext "When you have resolved this problem, run \"\$cmdline --resolved\"." >actual &&
65 test_cmp expect actual
68 test_done