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

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

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 26, 2012, 23:28 UTC
Message-ID
<7vy5m63xwd.fsf_-_@alter.siamese.dyndns.org>
In-Reply-To
<7v394e5cv5.fsf_-_@alter.siamese.dyndns.org>

And Michael's [4/5] would become like this (again, [3/5] does not need any change).

-- >8 --
From: Michael J Gruber <git@drmicha.warpmail.net>
Date: Thu, 26 Jul 2012 15:39:56 +0200

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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 t/README              |  5 +++++
 t/t0050-filesystem.sh | 24 +++++++-----------------
 t/test-lib.sh         | 13 +++++++++++++
 3 files changed, 25 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 52cb32a..95c966e 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -670,6 +670,19 @@ test_lazy_prereq CASE_INSENSITIVE_FS '
 	test "$(cat CamelCase)" != good
 '
 
+test_lazy_prereq UTF8_NFD_TO_NFC '
+	# check whether FS converts nfd unicode to nfc
+	auml=$(printf "\303\244")
+	aumlcdiar=$(printf "\141\314\210")
+	>"$auml" &&
+	case "$(echo *)" in
+	"$aumlcdiar")
+		true ;;
+	*)
+		false ;;
+	esac
+'
+
 # When the tests are run as root, permission tests will report that
 # things are writable when they shouldn't be.
 test -w / || test_set_prereq SANITY
-- 
1.7.12.rc0.44.gc69a8ad
Previous: Junio C HamanoNext: Jeff King
Message 4 of 7 in “test: rename $satisfied to $satisfied_prereq”
  1. 1/2 test: rename $satisfied to $satisfied_prereqJunio C Hamano, Jul 26, 2012
  2. 2/2 test: allow prerequisite to be evaluated lazilyJunio C Hamano, Jul 26, 2012
  3. 3/2 test-lib: provide case insensitivity as a prerequisiteJunio C Hamano, Jul 26, 2012
  4. 4/2 test-lib: provide UTF8 behaviour as a prerequisiteJunio C Hamano, Jul 26, 2012
  5. Jeff KingJul 27, 2012
  6. Jeff KingJul 27, 2012
  7. Junio C HamanoJul 27, 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.