Skip to content

Commit e72db08

Browse files
committed
Merge branch 'wc/make-funnynames-shared-lazy-prereq'
A test prerequisite defined by various test scripts with slightly different semantics has been consolidated into a single copy and made into a lazily defined one. * wc/make-funnynames-shared-lazy-prereq: t: factor out FUNNYNAMES as shared lazy prereq
2 parents 6bbd103 + 6ec6330 commit e72db08

File tree

5 files changed

+26
-25
lines changed

5 files changed

+26
-25
lines changed

t/t3600-rm.sh

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,13 @@ test_expect_success \
1414
git add -- foo bar baz 'space embedded' -q &&
1515
git commit -m 'add normal files'"
1616

17-
if test_have_prereq !MINGW && touch -- 'tab embedded' 'newline
18-
embedded' 2>/dev/null
19-
then
20-
test_set_prereq FUNNYNAMES
21-
else
17+
if test_have_prereq !FUNNYNAMES; then
2218
say 'Your filesystem does not allow tabs in filenames.'
2319
fi
2420

2521
test_expect_success FUNNYNAMES 'add files with funny names' "
22+
touch -- 'tab embedded' 'newline
23+
embedded' &&
2624
git add -- 'tab embedded' 'newline
2725
embedded' &&
2826
git commit -m 'add files with tabs and newlines'

t/t4135-apply-weird-filenames.sh

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,7 @@ test_expect_success 'setup' '
1515
git checkout -f preimage^0 &&
1616
git read-tree -u --reset HEAD &&
1717
git update-index --refresh
18-
} &&
19-
20-
test_when_finished "rm -f \"tab embedded.txt\"" &&
21-
test_when_finished "rm -f '\''\"quoteembedded\".txt'\''" &&
22-
if test_have_prereq !MINGW &&
23-
touch -- "tab embedded.txt" '\''"quoteembedded".txt'\''
24-
then
25-
test_set_prereq FUNNYNAMES
26-
fi
18+
}
2719
'
2820

2921
try_filename() {

t/t9902-completion.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1278,7 +1278,7 @@ test_expect_success 'setup for path completion tests' '
12781278
touch BS\\dir/DQ\"file \
12791279
'$'separators\034in\035dir/sep\036in\037file''
12801280
then
1281-
test_set_prereq FUNNYNAMES
1281+
test_set_prereq FUNNIERNAMES
12821282
else
12831283
rm -rf BS\\dir '$'separators\034in\035dir''
12841284
fi
@@ -1320,7 +1320,7 @@ test_expect_success '__git_complete_index_file - UTF-8 in ls-files output' '
13201320
test_path_completion árvíztűrő/С "árvíztűrő/Сайн яваарай"
13211321
'
13221322

1323-
test_expect_success FUNNYNAMES \
1323+
test_expect_success FUNNIERNAMES \
13241324
'__git_complete_index_file - C-style escapes in ls-files output' '
13251325
test_path_completion BS \
13261326
BS\\dir &&
@@ -1332,7 +1332,7 @@ test_expect_success FUNNYNAMES \
13321332
BS\\dir/DQ\"file
13331333
'
13341334

1335-
test_expect_success FUNNYNAMES \
1335+
test_expect_success FUNNIERNAMES \
13361336
'__git_complete_index_file - \nnn-escaped characters in ls-files output' '
13371337
test_path_completion sep '$'separators\034in\035dir'' &&
13381338
test_path_completion '$'separators\034i'' \

t/t9903-bash-prompt.sh

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,15 @@ test_expect_success 'prompt - unborn branch' '
6363
test_cmp expected "$actual"
6464
'
6565

66-
repo_with_newline='repo
67-
with
68-
newline'
69-
70-
if test_have_prereq !MINGW && mkdir "$repo_with_newline" 2>/dev/null
71-
then
72-
test_set_prereq FUNNYNAMES
73-
else
66+
if test_have_prereq !FUNNYNAMES; then
7467
say 'Your filesystem does not allow newlines in filenames.'
7568
fi
7669

7770
test_expect_success FUNNYNAMES 'prompt - with newline in path' '
71+
repo_with_newline="repo
72+
with
73+
newline" &&
74+
mkdir "$repo_with_newline" &&
7875
printf " (master)" >expected &&
7976
git init "$repo_with_newline" &&
8077
test_when_finished "rm -rf \"$repo_with_newline\"" &&

t/test-lib.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,6 +1104,20 @@ test_lazy_prereq CASE_INSENSITIVE_FS '
11041104
test "$(cat CamelCase)" != good
11051105
'
11061106

1107+
test_lazy_prereq FUNNYNAMES '
1108+
test_have_prereq !MINGW &&
1109+
touch -- \
1110+
"FUNNYNAMES tab embedded" \
1111+
"FUNNYNAMES \"quote embedded\"" \
1112+
"FUNNYNAMES newline
1113+
embedded" 2>/dev/null &&
1114+
rm -- \
1115+
"FUNNYNAMES tab embedded" \
1116+
"FUNNYNAMES \"quote embedded\"" \
1117+
"FUNNYNAMES newline
1118+
embedded" 2>/dev/null
1119+
'
1120+
11071121
test_lazy_prereq UTF8_NFD_TO_NFC '
11081122
# check whether FS converts nfd unicode to nfc
11091123
auml=$(printf "\303\244")

0 commit comments

Comments
 (0)