Skip to content

Commit 308566e

Browse files
Michael J Grubergitster
authored andcommitted
t3910: use the UTF8_NFD_TO_NFC test prereq
Besides reusing the new test prerequisite, this fixes also the issue that the current output is not TAP compliant and produces the output "no reason given" [for skipping]. Signed-off-by: Michael J Gruber <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5b0b5dd commit 308566e

File tree

1 file changed

+135
-146
lines changed

1 file changed

+135
-146
lines changed

t/t3910-mac-os-precompose.sh

Lines changed: 135 additions & 146 deletions
Original file line numberDiff line numberDiff line change
@@ -7,158 +7,147 @@ test_description='utf-8 decomposed (nfd) converted to precomposed (nfc)'
77

88
. ./test-lib.sh
99

10+
if ! test_have_prereq UTF8_NFD_TO_NFC
11+
then
12+
skip_all="filesystem does not corrupt utf-8"
13+
test_done
14+
fi
15+
16+
# create utf-8 variables
1017
Adiarnfc=`printf '\303\204'`
1118
Adiarnfd=`printf 'A\314\210'`
1219

13-
# check if the feature is compiled in
14-
mkdir junk &&
15-
>junk/"$Adiarnfc" &&
16-
case "$(cd junk && echo *)" in
17-
"$Adiarnfd")
18-
test_nfd=1
19-
;;
20-
*) ;;
21-
esac
22-
rm -rf junk
20+
Odiarnfc=`printf '\303\226'`
21+
Odiarnfd=`printf 'O\314\210'`
22+
AEligatu=`printf '\303\206'`
23+
Invalidu=`printf '\303\377'`
2324

2425

25-
if test "$test_nfd"
26-
then
27-
# create more utf-8 variables
28-
Odiarnfc=`printf '\303\226'`
29-
Odiarnfd=`printf 'O\314\210'`
30-
AEligatu=`printf '\303\206'`
31-
Invalidu=`printf '\303\377'`
26+
#Create a string with 255 bytes (decomposed)
27+
Alongd=$Adiarnfd$Adiarnfd$Adiarnfd$Adiarnfd$Adiarnfd$Adiarnfd$Adiarnfd #21 Byte
28+
Alongd=$Alongd$Alongd$Alongd #63 Byte
29+
Alongd=$Alongd$Alongd$Alongd$Alongd$Adiarnfd #255 Byte
3230

31+
#Create a string with 254 bytes (precomposed)
32+
Alongc=$AEligatu$AEligatu$AEligatu$AEligatu$AEligatu #10 Byte
33+
Alongc=$Alongc$Alongc$Alongc$Alongc$Alongc #50 Byte
34+
Alongc=$Alongc$Alongc$Alongc$Alongc$Alongc #250 Byte
35+
Alongc=$Alongc$AEligatu$AEligatu #254 Byte
3336

34-
#Create a string with 255 bytes (decomposed)
35-
Alongd=$Adiarnfd$Adiarnfd$Adiarnfd$Adiarnfd$Adiarnfd$Adiarnfd$Adiarnfd #21 Byte
36-
Alongd=$Alongd$Alongd$Alongd #63 Byte
37-
Alongd=$Alongd$Alongd$Alongd$Alongd$Adiarnfd #255 Byte
38-
39-
#Create a string with 254 bytes (precomposed)
40-
Alongc=$AEligatu$AEligatu$AEligatu$AEligatu$AEligatu #10 Byte
41-
Alongc=$Alongc$Alongc$Alongc$Alongc$Alongc #50 Byte
42-
Alongc=$Alongc$Alongc$Alongc$Alongc$Alongc #250 Byte
43-
Alongc=$Alongc$AEligatu$AEligatu #254 Byte
44-
45-
test_expect_success "detect if nfd needed" '
46-
precomposeunicode=`git config core.precomposeunicode` &&
47-
test "$precomposeunicode" = false &&
48-
git config core.precomposeunicode true
49-
'
50-
test_expect_success "setup" '
51-
>x &&
52-
git add x &&
53-
git commit -m "1st commit" &&
54-
git rm x &&
55-
git commit -m "rm x"
56-
'
57-
test_expect_success "setup case mac" '
58-
git checkout -b mac_os
59-
'
60-
# This will test nfd2nfc in readdir()
61-
test_expect_success "add file Adiarnfc" '
62-
echo f.Adiarnfc >f.$Adiarnfc &&
63-
git add f.$Adiarnfc &&
64-
git commit -m "add f.$Adiarnfc"
65-
'
66-
# This will test nfd2nfc in git stage()
67-
test_expect_success "stage file d.Adiarnfd/f.Adiarnfd" '
68-
mkdir d.$Adiarnfd &&
69-
echo d.$Adiarnfd/f.$Adiarnfd >d.$Adiarnfd/f.$Adiarnfd &&
70-
git stage d.$Adiarnfd/f.$Adiarnfd &&
71-
git commit -m "add d.$Adiarnfd/f.$Adiarnfd"
72-
'
73-
test_expect_success "add link Adiarnfc" '
74-
ln -s d.$Adiarnfd/f.$Adiarnfd l.$Adiarnfc &&
75-
git add l.$Adiarnfc &&
76-
git commit -m "add l.Adiarnfc"
77-
'
78-
# This will test git log
79-
test_expect_success "git log f.Adiar" '
80-
git log f.$Adiarnfc > f.Adiarnfc.log &&
81-
git log f.$Adiarnfd > f.Adiarnfd.log &&
82-
test -s f.Adiarnfc.log &&
83-
test -s f.Adiarnfd.log &&
84-
test_cmp f.Adiarnfc.log f.Adiarnfd.log &&
85-
rm f.Adiarnfc.log f.Adiarnfd.log
86-
'
87-
# This will test git ls-files
88-
test_expect_success "git lsfiles f.Adiar" '
89-
git ls-files f.$Adiarnfc > f.Adiarnfc.log &&
90-
git ls-files f.$Adiarnfd > f.Adiarnfd.log &&
91-
test -s f.Adiarnfc.log &&
92-
test -s f.Adiarnfd.log &&
93-
test_cmp f.Adiarnfc.log f.Adiarnfd.log &&
94-
rm f.Adiarnfc.log f.Adiarnfd.log
95-
'
96-
# This will test git mv
97-
test_expect_success "git mv" '
98-
git mv f.$Adiarnfd f.$Odiarnfc &&
99-
git mv d.$Adiarnfd d.$Odiarnfc &&
100-
git mv l.$Adiarnfd l.$Odiarnfc &&
101-
git commit -m "mv Adiarnfd Odiarnfc"
102-
'
103-
# Files can be checked out as nfc
104-
# And the link has been corrected from nfd to nfc
105-
test_expect_success "git checkout nfc" '
106-
rm f.$Odiarnfc &&
107-
git checkout f.$Odiarnfc
108-
'
109-
# Make it possible to checkout files with their NFD names
110-
test_expect_success "git checkout file nfd" '
111-
rm -f f.* &&
112-
git checkout f.$Odiarnfd
113-
'
114-
# Make it possible to checkout links with their NFD names
115-
test_expect_success "git checkout link nfd" '
116-
rm l.* &&
117-
git checkout l.$Odiarnfd
118-
'
119-
test_expect_success "setup case mac2" '
120-
git checkout master &&
121-
git reset --hard &&
122-
git checkout -b mac_os_2
123-
'
124-
# This will test nfd2nfc in git commit
125-
test_expect_success "commit file d2.Adiarnfd/f.Adiarnfd" '
126-
mkdir d2.$Adiarnfd &&
127-
echo d2.$Adiarnfd/f.$Adiarnfd >d2.$Adiarnfd/f.$Adiarnfd &&
128-
git add d2.$Adiarnfd/f.$Adiarnfd &&
129-
git commit -m "add d2.$Adiarnfd/f.$Adiarnfd" -- d2.$Adiarnfd/f.$Adiarnfd
130-
'
131-
test_expect_success "setup for long decomposed filename" '
132-
git checkout master &&
133-
git reset --hard &&
134-
git checkout -b mac_os_long_nfd_fn
135-
'
136-
test_expect_success "Add long decomposed filename" '
137-
echo longd >$Alongd &&
138-
git add * &&
139-
git commit -m "Long filename"
140-
'
141-
test_expect_success "setup for long precomposed filename" '
142-
git checkout master &&
143-
git reset --hard &&
144-
git checkout -b mac_os_long_nfc_fn
145-
'
146-
test_expect_success "Add long precomposed filename" '
147-
echo longc >$Alongc &&
148-
git add * &&
149-
git commit -m "Long filename"
150-
'
151-
# Test if the global core.precomposeunicode stops autosensing
152-
# Must be the last test case
153-
test_expect_success "respect git config --global core.precomposeunicode" '
154-
git config --global core.precomposeunicode true &&
155-
rm -rf .git &&
156-
git init &&
157-
precomposeunicode=`git config core.precomposeunicode` &&
158-
test "$precomposeunicode" = "true"
159-
'
160-
else
161-
say "Skipping nfc/nfd tests"
162-
fi
37+
test_expect_success "detect if nfd needed" '
38+
precomposeunicode=`git config core.precomposeunicode` &&
39+
test "$precomposeunicode" = false &&
40+
git config core.precomposeunicode true
41+
'
42+
test_expect_success "setup" '
43+
>x &&
44+
git add x &&
45+
git commit -m "1st commit" &&
46+
git rm x &&
47+
git commit -m "rm x"
48+
'
49+
test_expect_success "setup case mac" '
50+
git checkout -b mac_os
51+
'
52+
# This will test nfd2nfc in readdir()
53+
test_expect_success "add file Adiarnfc" '
54+
echo f.Adiarnfc >f.$Adiarnfc &&
55+
git add f.$Adiarnfc &&
56+
git commit -m "add f.$Adiarnfc"
57+
'
58+
# This will test nfd2nfc in git stage()
59+
test_expect_success "stage file d.Adiarnfd/f.Adiarnfd" '
60+
mkdir d.$Adiarnfd &&
61+
echo d.$Adiarnfd/f.$Adiarnfd >d.$Adiarnfd/f.$Adiarnfd &&
62+
git stage d.$Adiarnfd/f.$Adiarnfd &&
63+
git commit -m "add d.$Adiarnfd/f.$Adiarnfd"
64+
'
65+
test_expect_success "add link Adiarnfc" '
66+
ln -s d.$Adiarnfd/f.$Adiarnfd l.$Adiarnfc &&
67+
git add l.$Adiarnfc &&
68+
git commit -m "add l.Adiarnfc"
69+
'
70+
# This will test git log
71+
test_expect_success "git log f.Adiar" '
72+
git log f.$Adiarnfc > f.Adiarnfc.log &&
73+
git log f.$Adiarnfd > f.Adiarnfd.log &&
74+
test -s f.Adiarnfc.log &&
75+
test -s f.Adiarnfd.log &&
76+
test_cmp f.Adiarnfc.log f.Adiarnfd.log &&
77+
rm f.Adiarnfc.log f.Adiarnfd.log
78+
'
79+
# This will test git ls-files
80+
test_expect_success "git lsfiles f.Adiar" '
81+
git ls-files f.$Adiarnfc > f.Adiarnfc.log &&
82+
git ls-files f.$Adiarnfd > f.Adiarnfd.log &&
83+
test -s f.Adiarnfc.log &&
84+
test -s f.Adiarnfd.log &&
85+
test_cmp f.Adiarnfc.log f.Adiarnfd.log &&
86+
rm f.Adiarnfc.log f.Adiarnfd.log
87+
'
88+
# This will test git mv
89+
test_expect_success "git mv" '
90+
git mv f.$Adiarnfd f.$Odiarnfc &&
91+
git mv d.$Adiarnfd d.$Odiarnfc &&
92+
git mv l.$Adiarnfd l.$Odiarnfc &&
93+
git commit -m "mv Adiarnfd Odiarnfc"
94+
'
95+
# Files can be checked out as nfc
96+
# And the link has been corrected from nfd to nfc
97+
test_expect_success "git checkout nfc" '
98+
rm f.$Odiarnfc &&
99+
git checkout f.$Odiarnfc
100+
'
101+
# Make it possible to checkout files with their NFD names
102+
test_expect_success "git checkout file nfd" '
103+
rm -f f.* &&
104+
git checkout f.$Odiarnfd
105+
'
106+
# Make it possible to checkout links with their NFD names
107+
test_expect_success "git checkout link nfd" '
108+
rm l.* &&
109+
git checkout l.$Odiarnfd
110+
'
111+
test_expect_success "setup case mac2" '
112+
git checkout master &&
113+
git reset --hard &&
114+
git checkout -b mac_os_2
115+
'
116+
# This will test nfd2nfc in git commit
117+
test_expect_success "commit file d2.Adiarnfd/f.Adiarnfd" '
118+
mkdir d2.$Adiarnfd &&
119+
echo d2.$Adiarnfd/f.$Adiarnfd >d2.$Adiarnfd/f.$Adiarnfd &&
120+
git add d2.$Adiarnfd/f.$Adiarnfd &&
121+
git commit -m "add d2.$Adiarnfd/f.$Adiarnfd" -- d2.$Adiarnfd/f.$Adiarnfd
122+
'
123+
test_expect_success "setup for long decomposed filename" '
124+
git checkout master &&
125+
git reset --hard &&
126+
git checkout -b mac_os_long_nfd_fn
127+
'
128+
test_expect_success "Add long decomposed filename" '
129+
echo longd >$Alongd &&
130+
git add * &&
131+
git commit -m "Long filename"
132+
'
133+
test_expect_success "setup for long precomposed filename" '
134+
git checkout master &&
135+
git reset --hard &&
136+
git checkout -b mac_os_long_nfc_fn
137+
'
138+
test_expect_success "Add long precomposed filename" '
139+
echo longc >$Alongc &&
140+
git add * &&
141+
git commit -m "Long filename"
142+
'
143+
# Test if the global core.precomposeunicode stops autosensing
144+
# Must be the last test case
145+
test_expect_success "respect git config --global core.precomposeunicode" '
146+
git config --global core.precomposeunicode true &&
147+
rm -rf .git &&
148+
git init &&
149+
precomposeunicode=`git config core.precomposeunicode` &&
150+
test "$precomposeunicode" = "true"
151+
'
163152

164153
test_done

0 commit comments

Comments
 (0)