git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 3/4] test: use test_utf8 and GIT_LC_UTF8 where an en_US.UTF-8 locale is required

From
YDYann Droneaud <yann@droneaud.fr>
Date
Jan 6, 2011, 14:22 UTC
Message-ID
<97423472c08cd83373c769bf1cafdb9b85db37e3.1294312018.git.yann@droneaud.fr>
In-Reply-To
<cover.1294312018.git.yann@droneaud.fr>
Signed-off-by: Yann Droneaud <yann@droneaud.fr>
---
 t/t9100-git-svn-basic.sh               |   25 ++++++++-----------------
 t/t9129-git-svn-i18n-commitencoding.sh |   13 +++----------
 2 files changed, 11 insertions(+), 27 deletions(-)
diff --git a/t/t9100-git-svn-basic.sh b/t/t9100-git-svn-basic.sh
index b041516..fcdffef 100755
--- a/t/t9100-git-svn-basic.sh
+++ b/t/t9100-git-svn-basic.sh
@@ -4,20 +4,14 @@
 #
 
 test_description='git svn basic tests'
-GIT_SVN_LC_ALL=${LC_ALL:-$LANG}
 
 . ./lib-git-svn.sh
 
 say 'define NO_SVN_TESTS to skip git svn tests'
 
-case "$GIT_SVN_LC_ALL" in
-*.UTF-8)
-	test_set_prereq UTF8
-	;;
-*)
-	say "# UTF-8 locale not set, some tests skipped ($GIT_SVN_LC_ALL)"
-	;;
-esac
+if ! test_utf8 ; then
+	say "# UTF-8 locale not set, some tests skipped"
+fi
 
 test_expect_success \
     'initialize git svn' '
@@ -172,15 +166,12 @@ test_expect_success "$name" '
 	test ! -h "$SVN_TREE"/exec-2.sh &&
 	test_cmp help "$SVN_TREE"/exec-2.sh'
 
-name="commit with UTF-8 message: locale: $GIT_SVN_LC_ALL"
-LC_ALL="$GIT_SVN_LC_ALL"
-export LC_ALL
+name="commit with UTF-8 message: locale: $GIT_LC_UTF8"
 test_expect_success UTF8 "$name" "
-	echo '# hello' >> exec-2.sh &&
-	git update-index exec-2.sh &&
-	git commit -m 'éï∏' &&
-	git svn set-tree HEAD"
-unset LC_ALL
+	LC_ALL=$GIT_LC_UTF8 echo '# hello' >> exec-2.sh &&
+	LC_ALL=$GIT_LC_UTF8 git update-index exec-2.sh &&
+	LC_ALL=$GIT_LC_UTF8 git commit -m 'éï∏' &&
+	LC_ALL=$GIT_LC_UTF8 git svn set-tree HEAD"
 
 name='test fetch functionality (svn => git) with alternate GIT_SVN_ID'
 GIT_SVN_ID=alt
diff --git a/t/t9129-git-svn-i18n-commitencoding.sh b/t/t9129-git-svn-i18n-commitencoding.sh
index 8cfdfe7..f3bbde4 100755
--- a/t/t9129-git-svn-i18n-commitencoding.sh
+++ b/t/t9129-git-svn-i18n-commitencoding.sh
@@ -14,22 +14,15 @@ compare_git_head_with () {
 	test_cmp current "$1"
 }
 
-a_utf8_locale=$(locale -a | sed -n '/\.[uU][tT][fF]-*8$/{
-	p
-	q
-}')
-
-if test -n "$a_utf8_locale"
-then
-	test_set_prereq UTF8
-else
+if ! test_utf8 ; then
 	say "# UTF-8 locale not available, some tests are skipped"
 fi
 
 compare_svn_head_with () {
 	# extract just the log message and strip out committer info.
 	# don't use --limit here since svn 1.1.x doesn't have it,
-	LC_ALL="$a_utf8_locale" svn log `git svn info --url` | perl -w -e '
+	LC_ALL=$GIT_LC_UTF8 svn log `git svn info --url` | \
+	    LC_ALL=$GIT_LC_UTF8 perl -w -e '
 		use bytes;
 		$/ = ("-"x72) . "\n";
 		my @x = <STDIN>;
-- 
1.7.3.4
Previous: Junio C HamanoNext: Junio C Hamano
Message 18 of 23 in “t9129: fix UTF-8 locale detection”
  1. t9129: fix UTF-8 locale detectionYann Droneaud, May 18, 2010
  2. Michael J GruberMay 18, 2010
  3. Yann DroneaudMay 18, 2010
  4. t9129: fix UTF-8 locale detectionYann Droneaud, May 18, 2010
  5. Linus TorvaldsMay 18, 2010
  6. Andreas SchwabMay 18, 2010
  7. Linus TorvaldsMay 18, 2010
  8. Yann DroneaudMay 18, 2010
  9. Yann DroneaudMay 19, 2010
  10. Re* [PATCH] t9129: fix UTF-8 locale detectionJunio C Hamano, Jun 2, 2010
  11. Yann DroneaudMay 24, 2010
  12. Michael J GruberMay 25, 2010
  13. 0/4 en_US.UTF-8 locale detectionYann Droneaud, Jan 6, 2011
  14. 1/4 test: add a library to detect an en_US.UTF-8 localeYann Droneaud, Jan 6, 2011
  15. Junio C HamanoJan 7, 2011
  16. 2/4 test-lib.sh: add test_utf8() functionYann Droneaud, Jan 6, 2011
  17. Junio C HamanoJan 7, 2011
  18. 3/4 test: use test_utf8 and GIT_LC_UTF8 where an en_US.UTF-8 locale is requiredYann Droneaud, Jan 6, 2011
  19. Junio C HamanoJan 7, 2011
  20. 4/4 t9129: use "$PERL_PATH" instead of "perl"Yann Droneaud, Jan 6, 2011
  21. Junio C HamanoJan 7, 2011
  22. Yann DroneaudMay 18, 2010
  23. Miles BaderMay 19, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.