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

[PATCH 4/5] test-lib: provide UTF8 behaviour as a prerequisite

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
Jul 26, 2012, 13:39 UTC
Message-ID
<2d9b28dacc3e83d7aab1c3266bfbc53a3d3db906.1343309173.git.git@drmicha.warpmail.net>
In-Reply-To
<5001B82B.1060201@web.de>

UTF8 behaviour of the filesystem (conversion from nfd to nfc) plays a role in several tests and is tested in several tests. Therefore, move the test from t0050 into the test lib and use the prerequisite in t0050.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
---
 t/README              |  5 +++++
 t/t0050-filesystem.sh | 24 +++++++-----------------
 t/test-lib.sh         | 14 ++++++++++++++
 3 files changed, 26 insertions(+), 17 deletions(-)
diff --git a/t/README b/t/README
index 5725607..e4128e5 100644
--- a/t/README
+++ b/t/README
@@ -629,6 +629,11 @@ use these, and "test_set_prereq" for how to define your own.
 
    Test is run on a case insensitive file system.
 
+ - UTF8_NFD_TO_NFC
+
+   Test is run on a filesystem which converts decomposed utf-8 (nfd)
+   to precomposed utf-8 (nfc).
+
 Tips for Writing Tests
 ----------------------
 
diff --git a/t/t0050-filesystem.sh b/t/t0050-filesystem.sh
index b46ae72..78816d9 100755
--- a/t/t0050-filesystem.sh
+++ b/t/t0050-filesystem.sh
@@ -7,22 +7,6 @@ test_description='Various filesystem issues'
 auml=$(printf '\303\244')
 aumlcdiar=$(printf '\141\314\210')
 
-unibad=
-test_expect_success 'see what we expect' '
-
-	test_unicode=test_expect_success &&
-	mkdir junk &&
-	>junk/"$auml" &&
-	case "$(cd junk && echo *)" in
-	"$aumlcdiar")
-		test_unicode=test_expect_failure &&
-		unibad=t
-		;;
-	*)	;;
-	esac &&
-	rm -fr junk
-'
-
 if test_have_prereq CASE_INSENSITIVE_FS
 then
 	say "will test on a case insensitive filesystem"
@@ -31,8 +15,14 @@ else
 	test_case=test_expect_success
 fi
 
-test "$unibad" &&
+if test_have_prereq UTF8_NFD_TO_NFC
+then
 	say "will test on a unicode corrupting filesystem"
+	test_unicode=test_expect_failure
+else
+	test_unicode=test_expect_success
+fi
+
 test_have_prereq SYMLINKS ||
 	say "will test on a filesystem lacking symbolic links"
 
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 57fc1f2..057ac1d 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -676,3 +676,17 @@ then
 	test_set_prereq CASE_INSENSITIVE_FS
 fi
 rm -rf junk
+
+# check whether FS converts nfd unicode to nfc
+auml=$(printf '\303\244')
+aumlcdiar=$(printf '\141\314\210')
+
+mkdir junk &&
+>junk/"$auml" &&
+case "$(cd junk && echo *)" in
+"$aumlcdiar")
+	test_set_prereq UTF8_NFD_TO_NFC
+	;;
+*)	;;
+esac
+rm -fr junk
-- 
1.7.12.rc0.198.gd66b616
Previous: Michael J GruberNext: Michael J Gruber
Message 18 of 19 in “t3910: give reason for skipping the test”
  1. t3910: give reason for skipping the testMichael J Gruber, Jul 14, 2012
  2. Torsten BögershausenJul 14, 2012
  3. 0/5 test-lib: filesystem prerequisitesMichael J Gruber, Jul 26, 2012
  4. Junio C HamanoJul 26, 2012
  5. Jeff KingJul 26, 2012
  6. Junio C HamanoJul 26, 2012
  7. Michael J GruberJul 27, 2012
  8. Junio C HamanoJul 27, 2012
  9. Michael J GruberJul 30, 2012
  10. 5/5 t3910: use the UTF8_NFD_TO_NFC test prereqMichael J Gruber, Jul 30, 2012
  11. Junio C HamanoJul 30, 2012
  12. Torsten BögershausenAug 4, 2012
  13. Junio C HamanoAug 4, 2012
  14. Michael J GruberAug 6, 2012
  15. 1/5 test-lib: provide case insensitivity as a prerequisiteMichael J Gruber, Jul 26, 2012
  16. 2/5 t0050: use the CASE_INSENSITIVE_FS test prereqMichael J Gruber, Jul 26, 2012
  17. 3/5 t0050: use the SYMLINKS test prereqMichael J Gruber, Jul 26, 2012
  18. 4/5 test-lib: provide UTF8 behaviour as a prerequisiteMichael J Gruber, Jul 26, 2012
  19. 5/5 t3910: use the SYMLINKS test prereqMichael J Gruber, Jul 26, 2012

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.