Re: [PATCH 2/4] test-lib.sh: add test_utf8() function
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jan 7, 2011, 18:45 UTC
- Message-ID
- <7vtyhk7du0.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <8559d90bff6fca1c18f1cbf3530f2f4cc695f9f4.1294312018.git.yann@droneaud.fr>
Yann Droneaud <yann@droneaud.fr> writes:
Show 13 quoted lines
> +# check UTF-8 locale availability
> +test_utf8 () {
> + if test_have_prereq PERL ; then
> + # output an en_US.UTF-8 locale compatible name
> + GIT_LC_UTF8=`$PERL_PATH $GIT_BUILD_DIR/t/lib-locale.pl`
> + fi
> + if test -z "$GIT_LC_UTF8" ; then
> + return 1
> + else
> + test_set_prereq UTF8
> + return 0
> + fi
> +}Nice abstraction to have a helper function that picks a locale to be used when we want to test UTF-8 thingy. Perhaps pick_utf8_locale might be a better name, though.
The comment in the function is not wrong per-se, but it and the implementation in 1/4 may be too restrictive---all it needs to do is to pick a locale that is UTF-8, and it does not necessarily have to be en_US, no?