diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-10-24 17:11:55 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-10-24 17:11:55 +0200 |
commit | 17c838bc6da9ff7defb2a8d5ff539ec743acc1fc (patch) | |
tree | 1f22614f7fa3b230f25066174ac7fd5504400d36 /testsuite/patch.tests | |
parent | 1dacfbb1f466a2964cbf49855f336bcc1d25ebc0 (diff) | |
download | busybox-w32-17c838bc6da9ff7defb2a8d5ff539ec743acc1fc.tar.gz busybox-w32-17c838bc6da9ff7defb2a8d5ff539ec743acc1fc.tar.bz2 busybox-w32-17c838bc6da9ff7defb2a8d5ff539ec743acc1fc.zip |
patch: add longopts, --dry-run, add one more test
function old new delta
patch_main 1110 1214 +104
static.patch_longopts - 47 +47
packed_usage 26738 26761 +23
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/0 up/down: 174/0) Total: 174 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'testsuite/patch.tests')
-rwxr-xr-x | testsuite/patch.tests | 47 |
1 files changed, 41 insertions, 6 deletions
diff --git a/testsuite/patch.tests b/testsuite/patch.tests index cfe69b76a..178048d2a 100755 --- a/testsuite/patch.tests +++ b/testsuite/patch.tests | |||
@@ -7,7 +7,7 @@ | |||
7 | # testing "test name" "options" "expected result" "file input" "stdin" | 7 | # testing "test name" "options" "expected result" "file input" "stdin" |
8 | 8 | ||
9 | testing "patch with old_file == new_file" \ | 9 | testing "patch with old_file == new_file" \ |
10 | "patch; echo $?; cat input" \ | 10 | 'patch; echo $?; cat input' \ |
11 | "\ | 11 | "\ |
12 | patching file input | 12 | patching file input |
13 | 0 | 13 | 0 |
@@ -15,7 +15,10 @@ qwe | |||
15 | asd | 15 | asd |
16 | zxc | 16 | zxc |
17 | " \ | 17 | " \ |
18 | "qwe\nzxc\n" \ | 18 | "\ |
19 | qwe | ||
20 | zxc | ||
21 | " \ | ||
19 | "\ | 22 | "\ |
20 | --- input Jan 01 01:01:01 2000 | 23 | --- input Jan 01 01:01:01 2000 |
21 | +++ input Jan 01 01:01:01 2000 | 24 | +++ input Jan 01 01:01:01 2000 |
@@ -26,7 +29,7 @@ zxc | |||
26 | " \ | 29 | " \ |
27 | 30 | ||
28 | testing "patch with nonexistent old_file" \ | 31 | testing "patch with nonexistent old_file" \ |
29 | "patch; echo $?; cat input" \ | 32 | 'patch; echo $?; cat input' \ |
30 | "\ | 33 | "\ |
31 | patching file input | 34 | patching file input |
32 | 0 | 35 | 0 |
@@ -34,7 +37,10 @@ qwe | |||
34 | asd | 37 | asd |
35 | zxc | 38 | zxc |
36 | " \ | 39 | " \ |
37 | "qwe\nzxc\n" \ | 40 | "\ |
41 | qwe | ||
42 | zxc | ||
43 | " \ | ||
38 | "\ | 44 | "\ |
39 | --- input.doesnt_exist Jan 01 01:01:01 2000 | 45 | --- input.doesnt_exist Jan 01 01:01:01 2000 |
40 | +++ input Jan 01 01:01:01 2000 | 46 | +++ input Jan 01 01:01:01 2000 |
@@ -45,14 +51,18 @@ zxc | |||
45 | " \ | 51 | " \ |
46 | 52 | ||
47 | testing "patch -R with nonexistent old_file" \ | 53 | testing "patch -R with nonexistent old_file" \ |
48 | "patch -R; echo $?; cat input" \ | 54 | 'patch -R; echo $?; cat input' \ |
49 | "\ | 55 | "\ |
50 | patching file input | 56 | patching file input |
51 | 0 | 57 | 0 |
52 | qwe | 58 | qwe |
53 | zxc | 59 | zxc |
54 | " \ | 60 | " \ |
55 | "qwe\nasd\nzxc\n" \ | 61 | "\ |
62 | qwe | ||
63 | asd | ||
64 | zxc | ||
65 | " \ | ||
56 | "\ | 66 | "\ |
57 | --- input.doesnt_exist Jan 01 01:01:01 2000 | 67 | --- input.doesnt_exist Jan 01 01:01:01 2000 |
58 | +++ input Jan 01 01:01:01 2000 | 68 | +++ input Jan 01 01:01:01 2000 |
@@ -62,4 +72,29 @@ zxc | |||
62 | zxc | 72 | zxc |
63 | " \ | 73 | " \ |
64 | 74 | ||
75 | testing "patch detects already applied hunk" \ | ||
76 | 'patch 2>&1; echo $?; cat input' \ | ||
77 | "\ | ||
78 | patching file input | ||
79 | patch: hunk #1 FAILED at 1 | ||
80 | patch: 1 out of 1 hunk FAILED | ||
81 | 1 | ||
82 | abc | ||
83 | def | ||
84 | 123 | ||
85 | " \ | ||
86 | "\ | ||
87 | abc | ||
88 | def | ||
89 | 123 | ||
90 | " \ | ||
91 | "\ | ||
92 | --- input.old Jan 01 01:01:01 2000 | ||
93 | +++ input Jan 01 01:01:01 2000 | ||
94 | @@ -1,2 +1,3 @@ | ||
95 | abc | ||
96 | +def | ||
97 | 123 | ||
98 | " \ | ||
99 | |||
65 | exit $FAILCOUNT | 100 | exit $FAILCOUNT |