]>
Commit | Line | Data |
---|---|---|
ba67aaf2 ÆAB |
1 | #!/bin/sh |
2 | # | |
3 | # Copyright (c) 2010 Ævar Arnfjörð Bjarmason | |
4 | # | |
5 | ||
6 | test_description='Gettext Shell fallbacks' | |
7 | ||
5e9637c6 ÆAB |
8 | GIT_INTERNAL_GETTEXT_TEST_FALLBACKS=YesPlease |
9 | export GIT_INTERNAL_GETTEXT_TEST_FALLBACKS | |
10 | ||
618200d2 | 11 | TEST_PASSES_SANITIZE_LEAK=true |
5e9637c6 ÆAB |
12 | . ./lib-gettext.sh |
13 | ||
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" | |
16 | ' | |
17 | ||
18 | test_expect_success 'sanity: $GIT_INTERNAL_GETTEXT_TEST_FALLBACKS is set' ' | |
19 | test -n "$GIT_INTERNAL_GETTEXT_TEST_FALLBACKS" | |
20 | ' | |
21 | ||
a926c4b9 | 22 | test_expect_success 'sanity: $GIT_INTERNAL_GETTEXT_SH_SCHEME" is fallthrough' ' |
5e9637c6 ÆAB |
23 | echo fallthrough >expect && |
24 | echo $GIT_INTERNAL_GETTEXT_SH_SCHEME >actual && | |
25 | test_cmp expect actual | |
26 | ' | |
ba67aaf2 ÆAB |
27 | |
28 | test_expect_success 'gettext: our gettext() fallback has pass-through semantics' ' | |
29 | printf "test" >expect && | |
30 | gettext "test" >actual && | |
1108cea7 | 31 | test_cmp expect actual && |
ba67aaf2 ÆAB |
32 | printf "test more words" >expect && |
33 | gettext "test more words" >actual && | |
1108cea7 | 34 | test_cmp expect actual |
ba67aaf2 ÆAB |
35 | ' |
36 | ||
37 | test_expect_success 'eval_gettext: our eval_gettext() fallback has pass-through semantics' ' | |
38 | printf "test" >expect && | |
39 | eval_gettext "test" >actual && | |
1108cea7 | 40 | test_cmp expect actual && |
ba67aaf2 ÆAB |
41 | printf "test more words" >expect && |
42 | eval_gettext "test more words" >actual && | |
1108cea7 | 43 | test_cmp expect actual |
ba67aaf2 ÆAB |
44 | ' |
45 | ||
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 && | |
1108cea7 | 49 | test_cmp expect actual |
ba67aaf2 ÆAB |
50 | ' |
51 | ||
52 | test_expect_success 'eval_gettext: our eval_gettext() fallback can interpolate variables with spaces' ' | |
53 | cmdline="git am" && | |
99094a7a | 54 | export cmdline && |
c7108bf9 | 55 | printf "When you have resolved this problem, run git am --resolved." >expect && |
60687de5 | 56 | eval_gettext "When you have resolved this problem, run \$cmdline --resolved." >actual && |
1108cea7 | 57 | test_cmp expect actual |
ba67aaf2 ÆAB |
58 | ' |
59 | ||
60 | test_expect_success 'eval_gettext: our eval_gettext() fallback can interpolate variables with spaces and quotes' ' | |
61 | cmdline="git am" && | |
99094a7a | 62 | export cmdline && |
c7108bf9 | 63 | printf "When you have resolved this problem, run \"git am --resolved\"." >expect && |
60687de5 | 64 | eval_gettext "When you have resolved this problem, run \"\$cmdline --resolved\"." >actual && |
1108cea7 | 65 | test_cmp expect actual |
ba67aaf2 ÆAB |
66 | ' |
67 | ||
68 | test_done |