2 # Copyright 2008 by Denys Vlasenko
3 # Licensed under GPLv2, see file LICENSE in this source tree.
7 # testing "test name" "command(s)" "expected result" "file input" "stdin"
9 testing "patch with old_file == new_file" \
10 'patch 2>&1; echo $?; cat input' \
23 --- input Jan 01 01:01:01 2000
24 +++ input Jan 01 01:01:01 2000
31 testing "patch with nonexistent old_file" \
32 'patch 2>&1; echo $?; cat input' \
45 --- input.doesnt_exist Jan 01 01:01:01 2000
46 +++ input Jan 01 01:01:01 2000
53 testing "patch -R with nonexistent old_file" \
54 'patch -R 2>&1; echo $?; cat input' \
67 --- input.doesnt_exist Jan 01 01:01:01 2000
68 +++ input Jan 01 01:01:01 2000
75 testing "patch detects already applied hunk" \
76 'patch 2>&1; echo $?; cat input' \
78 Possibly reversed hunk 1 at 4
95 --- input.old Jan 01 01:01:01 2000
96 +++ input Jan 01 01:01:01 2000
103 testing "patch detects already applied hunk at the EOF" \
104 'patch 2>&1; echo $?; cat input' \
106 Possibly reversed hunk 1 at 4
123 --- input.old Jan 01 01:01:01 2000
124 +++ input Jan 01 01:01:01 2000
131 # testing "test name" "command(s)" "expected result" "file input" "stdin"
132 testing "patch -N ignores already applied hunk" \
133 'patch -N 2>&1; echo $?; cat input' \
155 # testing "test name" "command(s)" "expected result" "file input" "stdin"
156 testing "patch FILE PATCH" \
157 'cat >a.patch; patch input a.patch 2>&1; echo $?; cat input; rm a.patch' \
178 # testing "test name" "command(s)" "expected result" "file input" "stdin"
179 testing "patch at the beginning" \
180 'patch 2>&1; cat input' \
215 # testing "test name" "command(s)" "expected result" "file input" "stdin"
216 testing "patch creates new file" \
217 'patch 2>&1; echo $?; cat testfile; rm testfile' \
229 # testing "test name" "command(s)" "expected result" "file input" "stdin"
230 testing "patch understands ...dir///dir..." \
231 'patch -p1 2>&1; echo $?' \
233 patching file dir2///file
234 patch: can't open 'dir2///file': No such file or directory
237 --- bogus_dir///dir2///file
238 +++ bogus_dir///dir2///file
245 rm input.orig 2>/dev/null