]>
git.saurik.com Git - apt.git/blob - test/integration/test-method-rred
4 TESTDIR
=$(readlink -f $(dirname $0))
8 configarchitecture
'i386'
10 echo 'Package: coolstuff
12 Description: collection of stuff
13 A lot, too much to iterate all, but at least this:
22 Description: collection of outdated stuff
23 A lot, but of no use nowadays, but at least this:
28 And a dog.' > Packages
33 echo -n '' > Packages.ed
35 echo "$3" > Packages.ed
38 cat Packages
| runapt
"${METHODSDIR}/rred" "$@"
40 testsuccessequal
"$4" --nomsg rred
-f Packages.ed
43 testrred
'Remove' 'first line' '1d' "$(tail -n +2 ./Packages)"
44 testrred
'Remove' 'empty line' '10d' "$(head -n 9 ./Packages)
45 $(tail -n 9 ./Packages)"
46 testrred
'Remove' 'line in a paragraph' '5d' "$(head -n 4 ./Packages)
47 $(tail -n 14 ./Packages)"
48 testrred
'Remove' 'last line' '19d' "$(head -n -1 ./Packages)"
49 testrred
'Remove' 'multiple single lines' '17d
50 7d' "$(sed -e '/^ - even more stuff$/ d' ./Packages)"
51 testrred
'Remove' 'first paragraph' '1,10d' "$(tail -n 9 ./Packages)"
52 testrred
'Remove' 'a few lines in the middle' '5,14d' "$(head -n 4 ./Packages)
53 $(tail -n 5 ./Packages)"
54 testrred
'Remove' 'second paragraph' '10,19d' "$(head -n 9 ./Packages)"
55 testrred
'Mass Remove' 'all stuff lines' '15,17d
60 1d' "$(sed '/stuff/ d' ./Packages)"
62 testrred
'Single line add' 'first line' '0a
64 .' "Format: 3.0 (native)
66 testrred
'Single line add' 'last line' '19a
70 testrred
'Single line add' 'middle' '9a
72 .' "$(head -n 9 ./Packages)
74 $(tail -n 10 ./Packages)"
76 testrred
'Multi line add' 'first line' '0a
79 .' "Format: 3.0 (native)
82 testrred
'Multi line add' 'last line' '19a
84 Homepage: https://debian.org
87 Homepage: https://debian.org"
88 testrred
'Multi line add' 'middle' '9a
90 Homepage: https://debian.org
91 .' "$(head -n 9 ./Packages)
93 Homepage: https://debian.org
94 $(tail -n 10 ./Packages)"
96 testrred
'Single line change' 'first line' '1c
97 Package: supercoolstuff
98 .' "Package: supercoolstuff
99 $(tail -n +2 ./Packages)"
100 testrred
'Single line change' 'in the middle' '9c
102 .' "$(head -n 8 ./Packages)
104 $(tail -n 10 ./Packages)"
105 testrred
'Single line change' 'an empty line' '10c
107 .' "$(head -n 9 ./Packages)
109 $(tail -n 9 ./Packages)"
110 testrred
'Single line change' 'a spacy line' '10c
112 .' "$(head -n 9 ./Packages)
114 $(tail -n 9 ./Packages)"
115 testrred
'Single line change' 'last line' '19c
117 .' "$(head -n -1 ./Packages)
120 testrred
'Multi line change' 'exchange' '5,7c
123 - even more good stuff
124 .' "$(head -n 4 ./Packages)
127 - even more good stuff
128 $(tail -n 12 ./Packages)"
129 testrred
'Multi line change' 'less' '5,7c
132 .' "$(head -n 4 ./Packages)
135 $(tail -n 12 ./Packages)"
136 testrred
'Multi line change' 'more' '5,7c
139 - even more good stuff
141 .' "$(head -n 4 ./Packages)
144 - even more good stuff
146 $(tail -n 12 ./Packages)"
149 msgtest
'Failure caused by' "$1"
150 echo "$2" > Packages.ed
152 cat Packages
| runapt
"${METHODSDIR}/rred" "$@"
154 testfailure
--nomsg rred
-f Packages.ed
157 failrred
'Bogus content' '<html>
160 # not a problem per-se, but we want our parser to be really strict
161 failrred
'Empty patch file' ''
162 failrred
'Empty line patch file' '
164 failrred
'Empty line before command' '
166 failrred
'Empty line after command' '1d
168 failrred
'Empty line between commands' '17d
171 failrred
'Empty spaces lines before command' '
173 failrred
'Empty spaces lines after command' '1d
175 failrred
'Empty spaces lines between commands' '17d
179 # the line before the first one can't be deleted/changed
180 failrred
'zero line delete' '0d'
181 failrred
'zero line change' '0c
182 Package: supercoolstuff
184 # and this makes no sense at all
185 failrred
'negative line delete' '-1d'
186 failrred
'negative line change' '-1c
187 Package: supercoolstuff
189 failrred
'negative line add' '-1a
190 Package: supercoolstuff
192 failrred
'Wrong order of commands' '7d
194 failrred
'End before start' '7,6d'