t / t0201-gettext-fallbacks.shon commit t4000: make hash size independent (8cc5ff8)
   1#!/bin/sh
   2#
   3# Copyright (c) 2010 Ævar Arnfjörð Bjarmason
   4#
   5
   6test_description='Gettext Shell fallbacks'
   7
   8GIT_INTERNAL_GETTEXT_TEST_FALLBACKS=YesPlease
   9export GIT_INTERNAL_GETTEXT_TEST_FALLBACKS
  10
  11. ./lib-gettext.sh
  12
  13test_expect_success "sanity: \$GIT_INTERNAL_GETTEXT_SH_SCHEME is set (to $GIT_INTERNAL_GETTEXT_SH_SCHEME)" '
  14    test -n "$GIT_INTERNAL_GETTEXT_SH_SCHEME"
  15'
  16
  17test_expect_success 'sanity: $GIT_INTERNAL_GETTEXT_TEST_FALLBACKS is set' '
  18    test -n "$GIT_INTERNAL_GETTEXT_TEST_FALLBACKS"
  19'
  20
  21test_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
  25'
  26
  27test_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
  34'
  35
  36test_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
  43'
  44
  45test_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
  49'
  50
  51test_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
  57'
  58
  59test_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
  65'
  66
  67test_done