Skip to content

Commit 6508d03

Browse files
committed
Merge branch 'jc/test-prereq' into maint
* jc/test-prereq: t3910: use the UTF8_NFD_TO_NFC test prereq test-lib: provide UTF8 behaviour as a prerequisite t0050: use the SYMLINKS test prereq t0050: use the CASE_INSENSITIVE_FS test prereq test-lib: provide case insensitivity as a prerequisite test: allow prerequisite to be evaluated lazily test: rename $satisfied to $satisfied_prereq
2 parents 23193cf + 308566e commit 6508d03

File tree

6 files changed

+233
-205
lines changed

6 files changed

+233
-205
lines changed

t/README

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,15 @@ use these, and "test_set_prereq" for how to define your own.
625625
Git was compiled with USE_LIBPCRE=YesPlease. Wrap any tests
626626
that use git-grep --perl-regexp or git-grep -P in these.
627627

628+
- CASE_INSENSITIVE_FS
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+
628637
Tips for Writing Tests
629638
----------------------
630639

t/t0003-attributes.sh

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -123,16 +123,6 @@ test_expect_success 'attribute matching is case insensitive when core.ignorecase
123123
124124
'
125125

126-
test_expect_success 'check whether FS is case-insensitive' '
127-
mkdir junk &&
128-
echo good >junk/CamelCase &&
129-
echo bad >junk/camelcase &&
130-
if test "$(cat junk/CamelCase)" != good
131-
then
132-
test_set_prereq CASE_INSENSITIVE_FS
133-
fi
134-
'
135-
136126
test_expect_success CASE_INSENSITIVE_FS 'additional case insensitivity tests' '
137127
test_must_fail attr_check a/B/D/g "a/b/d/*" "-c core.ignorecase=0" &&
138128
test_must_fail attr_check A/B/D/NO "a/b/d/*" "-c core.ignorecase=0" &&

t/t0050-filesystem.sh

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

10-
case_insensitive=
11-
unibad=
12-
no_symlinks=
13-
test_expect_success 'see what we expect' '
14-
15-
test_case=test_expect_success &&
16-
test_unicode=test_expect_success &&
17-
mkdir junk &&
18-
echo good >junk/CamelCase &&
19-
echo bad >junk/camelcase &&
20-
if test "$(cat junk/CamelCase)" != good
21-
then
22-
test_case=test_expect_failure &&
23-
case_insensitive=t
24-
fi &&
25-
rm -fr junk &&
26-
mkdir junk &&
27-
>junk/"$auml" &&
28-
case "$(cd junk && echo *)" in
29-
"$aumlcdiar")
30-
test_unicode=test_expect_failure &&
31-
unibad=t
32-
;;
33-
*) ;;
34-
esac &&
35-
rm -fr junk &&
36-
{
37-
ln -s x y 2> /dev/null &&
38-
test -h y 2> /dev/null ||
39-
no_symlinks=1 &&
40-
rm -f y
41-
}
42-
'
43-
44-
test "$case_insensitive" &&
10+
if test_have_prereq CASE_INSENSITIVE_FS
11+
then
4512
say "will test on a case insensitive filesystem"
46-
test "$unibad" &&
13+
test_case=test_expect_failure
14+
else
15+
test_case=test_expect_success
16+
fi
17+
18+
if test_have_prereq UTF8_NFD_TO_NFC
19+
then
4720
say "will test on a unicode corrupting filesystem"
48-
test "$no_symlinks" &&
21+
test_unicode=test_expect_failure
22+
else
23+
test_unicode=test_expect_success
24+
fi
25+
26+
test_have_prereq SYMLINKS ||
4927
say "will test on a filesystem lacking symbolic links"
5028

51-
if test "$case_insensitive"
29+
if test_have_prereq CASE_INSENSITIVE_FS
5230
then
5331
test_expect_success "detection of case insensitive filesystem during repo init" '
5432
@@ -62,18 +40,18 @@ test_expect_success "detection of case insensitive filesystem during repo init"
6240
'
6341
fi
6442

65-
if test "$no_symlinks"
43+
if test_have_prereq SYMLINKS
6644
then
6745
test_expect_success "detection of filesystem w/o symlink support during repo init" '
6846
69-
v=$(git config --bool core.symlinks) &&
70-
test "$v" = false
47+
test_must_fail git config --bool core.symlinks ||
48+
test "$(git config --bool core.symlinks)" = true
7149
'
7250
else
7351
test_expect_success "detection of filesystem w/o symlink support during repo init" '
7452
75-
test_must_fail git config --bool core.symlinks ||
76-
test "$(git config --bool core.symlinks)" = true
53+
v=$(git config --bool core.symlinks) &&
54+
test "$v" = false
7755
'
7856
fi
7957

0 commit comments

Comments
 (0)