[PATCH 4/5] test-lib: provide UTF8 behaviour as a prerequisite
From: Michael J Gruber <hidden>
Date: 2016-06-15 22:54:21
Subsystem:
the rest · Maintainer:
Linus Torvalds
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 <redacted> --- 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