tests: stop using top-level "README" and "COPYING" files

In 459b8d22e54 (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 afd222967c6 (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 <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ævar Arnfjörð Bjarmason committed Oct 15, 2021 at 11:30 UTC 1c720357cef6e5af2aef5a31ecacad7752fbf9cc
4 files changed +19 -14
t/t4022-diff-rewrite.sh
+4 -2
@@ -3,15 +3,17 @@
3 test_description='rewrite diff'
4
5 . ./test-lib.sh
6 +. "$TEST_DIRECTORY"/lib-diff-data.sh
7
8 test_expect_success setup '
9
9 - cat "$TEST_DIRECTORY"/../COPYING >test &&
10 + COPYING_test_data >test.data &&
11 + cp test.data test &&
12 git add test &&
13 tr \
14 "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" \
15 "nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM" \
14 - <"$TEST_DIRECTORY"/../COPYING >test &&
16 + <test.data >test &&
17 echo "to be deleted" >test2 &&
18 blob=$(git hash-object test2) &&
19 blob=$(git rev-parse --short $blob) &&
t/t4023-diff-rename-typechange.sh
+6 -5
@@ -3,25 +3,26 @@
3 test_description='typechange rename detection'
4
5 . ./test-lib.sh
6 +. "$TEST_DIRECTORY"/lib-diff.sh
7
8 test_expect_success setup '
9
10 rm -f foo bar &&
10 - cat "$TEST_DIRECTORY"/../COPYING >foo &&
11 + COPYING_test_data >foo &&
12 test_ln_s_add linklink bar &&
13 git add foo &&
14 git commit -a -m Initial &&
15 git tag one &&
16
17 git rm -f foo bar &&
17 - cat "$TEST_DIRECTORY"/../COPYING >bar &&
18 + COPYING_test_data >bar &&
19 test_ln_s_add linklink foo &&
20 git add bar &&
21 git commit -a -m Second &&
22 git tag two &&
23
24 git rm -f foo bar &&
24 - cat "$TEST_DIRECTORY"/../COPYING >foo &&
25 + COPYING_test_data >foo &&
26 git add foo &&
27 git commit -a -m Third &&
28 git tag three &&
@@ -35,7 +36,7 @@ test_expect_success setup '
36 # This is purely for sanity check
37
38 git rm -f foo bar &&
38 - cat "$TEST_DIRECTORY"/../COPYING >foo &&
39 + COPYING_test_data >foo &&
40 cat "$TEST_DIRECTORY"/../Makefile >bar &&
41 git add foo bar &&
42 git commit -a -m Fifth &&
@@ -43,7 +44,7 @@ test_expect_success setup '
44
45 git rm -f foo bar &&
46 cat "$TEST_DIRECTORY"/../Makefile >foo &&
46 - cat "$TEST_DIRECTORY"/../COPYING >bar &&
47 + COPYING_test_data >bar &&
48 git add foo bar &&
49 git commit -a -m Sixth &&
50 git tag six
t/t7001-mv.sh
+3 -2
@@ -2,10 +2,11 @@
2
3 test_description='git mv in subdirs'
4 . ./test-lib.sh
5 +. "$TEST_DIRECTORY"/lib-diff-data.sh
6
7 test_expect_success 'prepare reference tree' '
8 mkdir path0 path1 &&
8 - cp "$TEST_DIRECTORY"/../COPYING path0/COPYING &&
9 + COPYING_test_data >path0/COPYING &&
10 git add path0/COPYING &&
11 git commit -m add -a
12 '
@@ -107,7 +108,7 @@ test_expect_success 'clean up' '
108 '
109
110 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 &&
112 git add path0/README &&
113 git commit -m add2 -a
114 '
t/t7101-reset-empty-subdirs.sh
+6 -5
@@ -5,10 +5,11 @@
5
6 test_description='git reset should cull empty subdirs'
7 . ./test-lib.sh
8 +. "$TEST_DIRECTORY"/lib-diff-data.sh
9
10 test_expect_success 'creating initial files' '
11 mkdir path0 &&
11 - cp "$TEST_DIRECTORY"/../COPYING path0/COPYING &&
12 + COPYING_test_data >path0/COPYING &&
13 git add path0/COPYING &&
14 git commit -m add -a
15 '
@@ -16,10 +17,10 @@ test_expect_success 'creating initial files' '
17 test_expect_success 'creating second files' '
18 mkdir path1 &&
19 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 &&
24 git add path1/path2/COPYING &&
25 git add path1/COPYING &&
26 git add COPYING &&