Magellan Linux

Diff of /trunk/mkinitrd-magellan/busybox/testsuite/patch.tests

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1178 by niro, Wed Aug 18 21:56:57 2010 UTC revision 1179 by niro, Wed Dec 15 21:33:41 2010 UTC
# Line 1  Line 1 
1  #!/bin/sh  #!/bin/sh
2  # Copyright 2008 by Denys Vlasenko  # Copyright 2008 by Denys Vlasenko
3  # Licensed under GPL v2, see file LICENSE for details.  # Licensed under GPLv2, see file LICENSE in this source tree.
4    
5  . ./testing.sh  . ./testing.sh
6    
7  # testing "test name" "options" "expected result" "file input" "stdin"  # testing "test name" "command(s)" "expected result" "file input" "stdin"
8    
9  testing "patch with old_file == new_file" \  testing "patch with old_file == new_file" \
10   'patch; echo $?; cat input' \   'patch 2>&1; echo $?; cat input' \
11  "\  "\
12  patching file input  patching file input
13  0  0
# Line 29  zxc Line 29  zxc
29  " \  " \
30    
31  testing "patch with nonexistent old_file" \  testing "patch with nonexistent old_file" \
32   'patch; echo $?; cat input' \   'patch 2>&1; echo $?; cat input' \
33  "\  "\
34  patching file input  patching file input
35  0  0
# Line 51  zxc Line 51  zxc
51  " \  " \
52    
53  testing "patch -R with nonexistent old_file" \  testing "patch -R with nonexistent old_file" \
54   'patch -R; echo $?; cat input' \   'patch -R 2>&1; echo $?; cat input' \
55  "\  "\
56  patching file input  patching file input
57  0  0
# Line 75  zxc Line 75  zxc
75  testing "patch detects already applied hunk" \  testing "patch detects already applied hunk" \
76   'patch 2>&1; echo $?; cat input' \   'patch 2>&1; echo $?; cat input' \
77  "\  "\
78    Possibly reversed hunk 1 at 2
79    Hunk 1 FAILED 1/1.
80     abc
81    +def
82     123
83  patching file input  patching file input
 patch: hunk #1 FAILED at 1  
 patch: 1 out of 1 hunk FAILED  
84  1  1
85  abc  abc
86  def  def
# Line 97  def Line 100  def
100   123   123
101  " \  " \
102    
103  # Currently fails (erroneously appends second "456" line):  testing "patch detects already applied hunk at the EOF" \
 false && testing "patch detects already applied hunk" \  
104   'patch 2>&1; echo $?; cat input' \   'patch 2>&1; echo $?; cat input' \
105  "\  "\
106    Possibly reversed hunk 1 at 3
107    Hunk 1 FAILED 1/1.
108     abc
109     123
110    +456
111  patching file input  patching file input
 patch: hunk #1 FAILED at 2  
 patch: 1 out of 1 hunk FAILED  
112  1  1
113  abc  abc
114  123  123
# Line 123  abc Line 128  abc
128  +456  +456
129  " \  " \
130    
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' \
134    "\
135    patching file input
136    0
137    abc
138    def
139    123
140    " \
141    "\
142    abc
143    def
144    123
145    " \
146    "\
147    --- input
148    +++ input
149    @@ -1,2 +1,3 @@
150     abc
151    +def
152     123
153    " \
154    
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' \
158    "\
159    patching file input
160    0
161    abc
162    def
163    123
164    " \
165    "\
166    abc
167    123
168    " \
169    "\
170    --- foo.old
171    +++ foo
172    @@ -1,2 +1,3 @@
173     abc
174    +def
175     123
176    " \
177    
178  rm input.orig 2>/dev/null  rm input.orig 2>/dev/null
179    
180  exit $FAILCOUNT  exit $FAILCOUNT

Legend:
Removed from v.1178  
changed lines
  Added in v.1179