Skip to content

Commit 1c72035

Browse files
avargitster
authored andcommitted
tests: stop using top-level "README" and "COPYING" files
In 459b8d2 (tests: do not borrow from COPYING and README from the real source, 2015-02-15) tests that used "lib-diff.sh" (called "diff-lib.sh" then) were made to stop relying on the top-level COPYING file, but we still had other tests that referenced it. Let's move them over to use the "COPYING_test_data" utility function introduced in the preceding commit, and in the case of the one test that needed the "README" file use a ROT 13 version of that "COPYING" test data. That test added in afd2229 (Extend testing git-mv for renaming of subdirectories, 2006-07-26) just needs more test data that's not the same as the "COPYING" test data, so a ROT 13 version will do. This change removes the last references to ../{README,COPYING} in the test suite. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 15b808d commit 1c72035

File tree

4 files changed

+19
-14
lines changed

4 files changed

+19
-14
lines changed

t/t4022-diff-rewrite.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,17 @@
33
test_description='rewrite diff'
44

55
. ./test-lib.sh
6+
. "$TEST_DIRECTORY"/lib-diff-data.sh
67

78
test_expect_success setup '
89
9-
cat "$TEST_DIRECTORY"/../COPYING >test &&
10+
COPYING_test_data >test.data &&
11+
cp test.data test &&
1012
git add test &&
1113
tr \
1214
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" \
1315
"nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM" \
14-
<"$TEST_DIRECTORY"/../COPYING >test &&
16+
<test.data >test &&
1517
echo "to be deleted" >test2 &&
1618
blob=$(git hash-object test2) &&
1719
blob=$(git rev-parse --short $blob) &&

t/t4023-diff-rename-typechange.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,26 @@
33
test_description='typechange rename detection'
44

55
. ./test-lib.sh
6+
. "$TEST_DIRECTORY"/lib-diff.sh
67

78
test_expect_success setup '
89
910
rm -f foo bar &&
10-
cat "$TEST_DIRECTORY"/../COPYING >foo &&
11+
COPYING_test_data >foo &&
1112
test_ln_s_add linklink bar &&
1213
git add foo &&
1314
git commit -a -m Initial &&
1415
git tag one &&
1516
1617
git rm -f foo bar &&
17-
cat "$TEST_DIRECTORY"/../COPYING >bar &&
18+
COPYING_test_data >bar &&
1819
test_ln_s_add linklink foo &&
1920
git add bar &&
2021
git commit -a -m Second &&
2122
git tag two &&
2223
2324
git rm -f foo bar &&
24-
cat "$TEST_DIRECTORY"/../COPYING >foo &&
25+
COPYING_test_data >foo &&
2526
git add foo &&
2627
git commit -a -m Third &&
2728
git tag three &&
@@ -35,15 +36,15 @@ test_expect_success setup '
3536
# This is purely for sanity check
3637
3738
git rm -f foo bar &&
38-
cat "$TEST_DIRECTORY"/../COPYING >foo &&
39+
COPYING_test_data >foo &&
3940
cat "$TEST_DIRECTORY"/../Makefile >bar &&
4041
git add foo bar &&
4142
git commit -a -m Fifth &&
4243
git tag five &&
4344
4445
git rm -f foo bar &&
4546
cat "$TEST_DIRECTORY"/../Makefile >foo &&
46-
cat "$TEST_DIRECTORY"/../COPYING >bar &&
47+
COPYING_test_data >bar &&
4748
git add foo bar &&
4849
git commit -a -m Sixth &&
4950
git tag six

t/t7001-mv.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

33
test_description='git mv in subdirs'
44
. ./test-lib.sh
5+
. "$TEST_DIRECTORY"/lib-diff-data.sh
56

67
test_expect_success 'prepare reference tree' '
78
mkdir path0 path1 &&
8-
cp "$TEST_DIRECTORY"/../COPYING path0/COPYING &&
9+
COPYING_test_data >path0/COPYING &&
910
git add path0/COPYING &&
1011
git commit -m add -a
1112
'
@@ -107,7 +108,7 @@ test_expect_success 'clean up' '
107108
'
108109

109110
test_expect_success 'adding another file' '
110-
cp "$TEST_DIRECTORY"/../README.md path0/README &&
111+
COPYING_test_data | tr A-Za-z N-ZA-Mn-za-m >path0/README &&
111112
git add path0/README &&
112113
git commit -m add2 -a
113114
'

t/t7101-reset-empty-subdirs.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,22 @@
55

66
test_description='git reset should cull empty subdirs'
77
. ./test-lib.sh
8+
. "$TEST_DIRECTORY"/lib-diff-data.sh
89

910
test_expect_success 'creating initial files' '
1011
mkdir path0 &&
11-
cp "$TEST_DIRECTORY"/../COPYING path0/COPYING &&
12+
COPYING_test_data >path0/COPYING &&
1213
git add path0/COPYING &&
1314
git commit -m add -a
1415
'
1516

1617
test_expect_success 'creating second files' '
1718
mkdir path1 &&
1819
mkdir path1/path2 &&
19-
cp "$TEST_DIRECTORY"/../COPYING path1/path2/COPYING &&
20-
cp "$TEST_DIRECTORY"/../COPYING path1/COPYING &&
21-
cp "$TEST_DIRECTORY"/../COPYING COPYING &&
22-
cp "$TEST_DIRECTORY"/../COPYING path0/COPYING-TOO &&
20+
COPYING_test_data >path1/path2/COPYING &&
21+
COPYING_test_data >path1/COPYING &&
22+
COPYING_test_data >COPYING &&
23+
COPYING_test_data >path0/COPYING-TOO &&
2324
git add path1/path2/COPYING &&
2425
git add path1/COPYING &&
2526
git add COPYING &&

0 commit comments

Comments
 (0)