2 # Copyright 2008 by Denys Vlasenko
3 # Licensed under GPL v2, see file LICENSE for details.
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 2
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 3
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"
133 testing "patch -N ignores already applied hunk" \
134 'patch -N 2>&1; echo $?; cat input' \
156 rm input.orig 2>/dev/null