test-lib: provide UTF8 behaviour as a prerequisite
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>
Michael J Gruber committed
Jul 26, 2012 at 15:39 UTC
5b0b5dd49b55e474a2df502902682853e2cd6e9d
3 files changed
+25
-17
t/README
+5
@@ -629,6 +629,11 @@ use these, and "test_set_prereq" for how to define your own.
629
630
Test is run on a case insensitive file system.
631
632
+ - UTF8_NFD_TO_NFC
633
+
634
+ Test is run on a filesystem which converts decomposed utf-8 (nfd)
635
+ to precomposed utf-8 (nfc).
636
+
637
Tips for Writing Tests
638
----------------------
639
t/t0050-filesystem.sh
+7
-17
@@ -7,22 +7,6 @@ test_description='Various filesystem issues'
7
auml=$(printf '\303\244')
8
aumlcdiar=$(printf '\141\314\210')
9
10
-unibad=
11
-test_expect_success 'see what we expect' '
12
-
13
- test_unicode=test_expect_success &&
14
- mkdir junk &&
15
- >junk/"$auml" &&
16
- case "$(cd junk && echo *)" in
17
- "$aumlcdiar")
18
- test_unicode=test_expect_failure &&
19
- unibad=t
20
- ;;
21
- *) ;;
22
- esac &&
23
- rm -fr junk
24
-'
25
-
10
if test_have_prereq CASE_INSENSITIVE_FS
11
then
12
say "will test on a case insensitive filesystem"
@@ -31,8 +15,14 @@ else
15
test_case=test_expect_success
16
fi
17
34
-test "$unibad" &&
18
+if test_have_prereq UTF8_NFD_TO_NFC
19
+then
20
say "will test on a unicode corrupting filesystem"
21
+ test_unicode=test_expect_failure
22
+else
23
+ test_unicode=test_expect_success
24
+fi
25
+
26
test_have_prereq SYMLINKS ||
27
say "will test on a filesystem lacking symbolic links"
28
t/test-lib.sh
+13
@@ -670,6 +670,19 @@ test_lazy_prereq CASE_INSENSITIVE_FS '
670
test "$(cat CamelCase)" != good
671
'
672
673
+test_lazy_prereq UTF8_NFD_TO_NFC '
674
+ # check whether FS converts nfd unicode to nfc
675
+ auml=$(printf "\303\244")
676
+ aumlcdiar=$(printf "\141\314\210")
677
+ >"$auml" &&
678
+ case "$(echo *)" in
679
+ "$aumlcdiar")
680
+ true ;;
681
+ *)
682
+ false ;;
683
+ esac
684
+'
685
+
686
# When the tests are run as root, permission tests will report that
687
# things are writable when they shouldn't be.
688
test -w / || test_set_prereq SANITY