Skip to content

Commit 5b0b5dd

Browse files
Michael J Grubergitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2b71b52 commit 5b0b5dd

File tree

3 files changed

+25
-17
lines changed

3 files changed

+25
-17
lines changed

t/README

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,11 @@ use these, and "test_set_prereq" for how to define your own.
629629

630630
Test is run on a case insensitive file system.
631631

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+
632637
Tips for Writing Tests
633638
----------------------
634639

t/t0050-filesystem.sh

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,6 @@ test_description='Various filesystem issues'
77
auml=$(printf '\303\244')
88
aumlcdiar=$(printf '\141\314\210')
99

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-
2610
if test_have_prereq CASE_INSENSITIVE_FS
2711
then
2812
say "will test on a case insensitive filesystem"
@@ -31,8 +15,14 @@ else
3115
test_case=test_expect_success
3216
fi
3317

34-
test "$unibad" &&
18+
if test_have_prereq UTF8_NFD_TO_NFC
19+
then
3520
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+
3626
test_have_prereq SYMLINKS ||
3727
say "will test on a filesystem lacking symbolic links"
3828

t/test-lib.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,19 @@ test_lazy_prereq CASE_INSENSITIVE_FS '
670670
test "$(cat CamelCase)" != good
671671
'
672672

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+
673686
# When the tests are run as root, permission tests will report that
674687
# things are writable when they shouldn't be.
675688
test -w / || test_set_prereq SANITY

0 commit comments

Comments
 (0)