source: trunk/src/sed/testsuite/misc.pl@ 3670

Last change on this file since 3670 was 3613, checked in by bird, 10 months ago

src/sed: Merged in changes between 4.1.5 and 4.9 from the vendor branch. (svn merge /vendor/sed/4.1.5 /vendor/sed/current .)

File size: 37.8 KB
Line 
1#!/usr/bin/perl
2# Test misc.
3
4# Copyright (C) 2017-2022 Free Software Foundation, Inc.
5
6# This program is free software: you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation, either version 3 of the License, or
9# (at your option) any later version.
10
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15
16# You should have received a copy of the GNU General Public License
17# along with this program. If not, see <https://www.gnu.org/licenses/>.
18
19use strict;
20use File::stat;
21
22(my $program_name = $0) =~ s|.*/||;
23
24# Turn off localization of executable's output.
25@ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
26
27my $prog = 'sed';
28
29print "PATH = $ENV{PATH}\n";
30
31my @Tests =
32 (
33 ['empty', qw(-e ''), {IN=>''}, {OUT=>''}],
34 ['empty2', q('s/^ *//'), {IN=>"x\n\n"}, {OUT=>"x\n\n"}],
35
36 ['head', qw(3q), {IN=>"1\n2\n3\n4\n"}, {OUT=>"1\n2\n3\n"}],
37 ['space', q('s/_\S/XX/g;s/\s/_/g'),
38 {IN=> "Hello World\t!\nSecond_line_ of tests\n" },
39 {OUT=> "Hello_World_!\nSecondXXine__of_tests\n" }],
40
41 ['zero-anchor', qw(-z), q('N;N;s/^/X/g;s/^/X/mg;s/$/Y/g;s/$/Y/mg'),
42 {IN=>"a\0b\0c\0" },
43 {OUT=>"XXaY\0XbY\0XcYY\0" }],
44
45 ['case-insensitive', qw(-n), q('h;s/Version: *//p;g;s/version: *//Ip'),
46 {IN=>"Version: 1.2.3\n" },
47 {OUT=>"1.2.3\n1.2.3\n" },
48 ],
49
50 ['preserve-missing-EOL-at-EOF', q('s/$/x/'),
51 {IN=> "a\nb" },
52 {OUT=>"ax\nbx" },
53 ],
54
55 ['y-bracket', q('y/[/ /'),
56 {IN => "Are you sure (y/n)? [y]\n" },
57 {OUT=> "Are you sure (y/n)? y]\n" },
58 ],
59
60 ['y-zero', q('y/b/\x00/'),
61 {IN => "abc\n" },
62 {OUT=> "a\0c\n" },
63 ],
64
65 ['y-newline', q('H
66G
67y/Ss\nYy/yY$sS/'),
68 {IN => "Are you sure (y/n)? [y]\n" },
69 {OUT=> 'Are Sou Yure (S/n)? [S]$$Are Sou Yure (S/n)? [S]'."\n"},
70 ],
71
72 ['allsub', q('s/foo/bar/g'),
73 {IN => "foo foo fo oo f oo foo foo foo foo foo foo foo foo foo\n"},
74 {OUT=> "bar bar fo oo f oo bar bar bar bar bar bar bar bar bar\n"},
75 ],
76
77 ['insert-nl', qw(-f), {IN => "/foo/i\\\n"},
78 {IN => "bar\nfoo\n" },
79 {OUT=> "bar\n\nfoo\n" },
80 ],
81
82 ['recall',
83 # Check that the empty regex recalls the last *executed* regex,
84 # not the last *compiled* regex
85 qw(-f), {IN => "p;s/e/X/p;:x;s//Y/p;/f/bx"},
86 {IN => "eeefff\n" },
87 {OUT=> "eeefff\n"
88 . "Xeefff\n"
89 . "XYefff\n"
90 . "XYeYff\n"
91 . "XYeYYf\n"
92 . "XYeYYY\n"
93 . "XYeYYY\n"
94 },
95 ],
96
97 ['recall2',
98 # Starting from sed 4.1.3, regexes are compiled with REG_NOSUB
99 # if they are used in an address, so that the matcher does not
100 # have to obey leftmost-longest. The tricky part is to recompile
101 # them if they are then used in a substitution.
102 qw(-f), {IN => '/\(ab*\)\+/ s//>\1</g'},
103 {IN => "ababb||abbbabbbb\n" },
104 {OUT=> ">abb<||>abbbb<\n" },
105 ],
106
107 ['0range',
108 # Test address 0 (GNU extension)
109 # FIXME: This test does NOT actually fail if the address is changed to 1.
110 qw(-e '0,/aaa/d'),
111 {IN => "1\n"
112 . "2\n"
113 . "3\n"
114 . "4\n"
115 . "aaa\n"
116 . "yes\n"},
117 {OUT => "yes\n"}
118 ],
119
120 ['amp-escape',
121 # Test ampersand as escape sequence (ASCII 0x26), which should
122 # not have a special meaning (i.e. the 'matched pattern')
123 qw(-e 's/yes/yes\x26/'),
124 {IN => "yes\n"},
125 {OUT => "yes&\n"}
126 ],
127
128 ['appquit',
129 # Test 'a'ppend command before 'q'uit
130 qw(-f),
131 {IN => q(a\
132ok
133q)},
134 {IN => "doh\n"},
135 {OUT => "doh\n"
136 . "ok\n"}
137 ],
138
139
140 ['brackets',
141 qw(-f),
142 {IN => q(s/[[]/a/
143s/[[[]/b/
144s/[[[[]/c/
145s/[[[[[]/d/
146s/[[[[[[]/e/
147s/[[[[[[[]/f/
148s/[[[[[[[[]/g/
149s/[[[[[[[[[]/h/
150)},
151 {IN => "[[[[[[[[[\n"},
152 {OUT => "abcdefgh[\n"}
153 ],
154
155
156 ['bkslashes',
157 # Test backslashes in regex
158 # bug in sed 4.0b
159 qw(-f),
160 {IN => q(s/$/\\\\\
161/
162)},
163 {IN => "a\n"},
164 {OUT => "a\\\n"
165 . "\n"}
166 ],
167
168 ['classes',
169 # inspired by an autoconf generated configure script.
170 qw(-n -f),
171 {IN => 's/^\([/[:lower:]A-Z0-9]*_cv_[[:lower:][:upper:]/[:digit:]]*\)'.
172 '=\(.*\)/: \${\1=\'\2\'}/p'},
173 {IN => "_cv_=emptyvar\n"
174 . "ac_cv_prog/RANLIB=/usr/bin/ranlib\n"
175 . "ac_cv_prog/CC=/usr/unsupported/\\ \\ /lib/_cv_/cc\n"
176 . "a/c_cv_prog/CPP=/usr/bin/cpp\n"
177 . "SHELL=bash\n"
178 . "GNU=GNU!UNIX\n"},
179 {OUT => ": \${_cv_='emptyvar'}\n"
180 . ": \${ac_cv_prog/RANLIB='/usr/bin/ranlib'}\n"
181 . ": \${ac_cv_prog/CC='/usr/unsupported/\\ \\ /lib/_cv_/cc'}\n"
182 . ": \${a/c_cv_prog/CPP='/usr/bin/cpp'}\n"}
183 ],
184
185
186 ['cv-vars',
187 # inspired by an autoconf generated configure script.
188 qw(-n -f),
189 {IN => q|s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/: \${\1='\2'}/p|},
190 {IN => "_cv_=emptyvar\n"
191 . "ac_cv_prog_RANLIB=/usr/bin/ranlib\n"
192 . "ac_cv_prog_CC=/usr/unsupported/\ \ /lib/_cv_/cc\n"
193 . "ac_cv_prog_CPP=/usr/bin/cpp\n"
194 . "SHELL=bash\n"
195 . "GNU=GNU!UNIX\n"},
196 {OUT => ": \${_cv_='emptyvar'}\n"
197 . ": \${ac_cv_prog_RANLIB='/usr/bin/ranlib'}\n"
198 . ": \${ac_cv_prog_CC='/usr/unsupported/\ \ /lib/_cv_/cc'}\n"
199 . ": \${ac_cv_prog_CPP='/usr/bin/cpp'}\n"}
200 ],
201
202 ['quiet',
203 # the old 'quiet' test: --quiet instead of -n
204 qw(--quiet -f),
205 {IN => q|s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/: \${\1='\2'}/p|},
206 {IN => "_cv_=emptyvar\n"
207 . "ac_cv_prog_RANLIB=/usr/bin/ranlib\n"
208 . "ac_cv_prog_CC=/usr/unsupported/\ \ /lib/_cv_/cc\n"
209 . "ac_cv_prog_CPP=/usr/bin/cpp\n"
210 . "SHELL=bash\n"
211 . "GNU=GNU!UNIX\n"},
212 {OUT => ": \${_cv_='emptyvar'}\n"
213 . ": \${ac_cv_prog_RANLIB='/usr/bin/ranlib'}\n"
214 . ": \${ac_cv_prog_CC='/usr/unsupported/\ \ /lib/_cv_/cc'}\n"
215 . ": \${ac_cv_prog_CPP='/usr/bin/cpp'}\n"}
216 ],
217
218 ['file',
219 # the old 'file' test: --file instead of -f
220 qw(-n --file),
221 {IN => q|s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/: \${\1='\2'}/p|},
222 {IN => "_cv_=emptyvar\n"
223 . "ac_cv_prog_RANLIB=/usr/bin/ranlib\n"
224 . "ac_cv_prog_CC=/usr/unsupported/\ \ /lib/_cv_/cc\n"
225 . "ac_cv_prog_CPP=/usr/bin/cpp\n"
226 . "SHELL=bash\n"
227 . "GNU=GNU!UNIX\n"},
228 {OUT => ": \${_cv_='emptyvar'}\n"
229 . ": \${ac_cv_prog_RANLIB='/usr/bin/ranlib'}\n"
230 . ": \${ac_cv_prog_CC='/usr/unsupported/\ \ /lib/_cv_/cc'}\n"
231 . ": \${ac_cv_prog_CPP='/usr/bin/cpp'}\n"}
232 ],
233
234
235 ['dollar',
236 # Test replacement on the last line (address '$')
237 qw(-e '$s/^/space /'),
238 {IN => "I can't quite remember where I heard it,\n"
239 . "but I can't seem to get out of my head\n"
240 . "the phrase\n"
241 . "the final frontier\n"},
242 {OUT => "I can't quite remember where I heard it,\n"
243 . "but I can't seem to get out of my head\n"
244 . "the phrase\n"
245 . "space the final frontier\n"}
246 ],
247
248 ['enable',
249 # inspired by an autoconf generated configure script.
250 qw(-e 's/-*enable-//;s/=.*//'),
251 {IN => "--enable-targets=sparc-sun-sunos4.1.3,srec\n"
252 . "--enable-x11-testing=on\n"
253 . "--enable-wollybears-in-minnesota=yes-id-like-that\n"},
254 {OUT => "targets\n"
255 . "x11-testing\n"
256 . "wollybears-in-minnesota\n"}
257 ],
258
259 ['fasts',
260 # test `fast' substitutions
261 qw(-f),
262 {IN => q(
263h
264s/a//
265p
266g
267s/a//g
268p
269g
270s/^a//p
271g
272s/^a//g
273p
274g
275s/not present//g
276p
277g
278s/^[a-z]//g
279p
280g
281s/a$//
282p
283g
284
285y/a/b/
286h
287s/b//
288p
289g
290s/b//g
291p
292g
293s/^b//p
294g
295s/^b//g
296p
297g
298s/^[a-z]//g
299p
300g
301s/b$//
302p
303g
304)},
305 {IN => "aaaaaaabbbbbbaaaaaaa\n"},
306 {OUT => "aaaaaabbbbbbaaaaaaa\n"
307 . "bbbbbb\n"
308 . "aaaaaabbbbbbaaaaaaa\n"
309 . "aaaaaabbbbbbaaaaaaa\n"
310 . "aaaaaaabbbbbbaaaaaaa\n"
311 . "aaaaaabbbbbbaaaaaaa\n"
312 . "aaaaaaabbbbbbaaaaaa\n"
313 . "bbbbbbbbbbbbbbbbbbb\n"
314 . "\n"
315 . "bbbbbbbbbbbbbbbbbbb\n"
316 . "bbbbbbbbbbbbbbbbbbb\n"
317 . "bbbbbbbbbbbbbbbbbbb\n"
318 . "bbbbbbbbbbbbbbbbbbb\n"
319 . "bbbbbbbbbbbbbbbbbbbb\n"}
320 ],
321
322
323
324 ['factor',
325 # Compute a few common factors for speed. Clear the subst flag
326 # These are placed here to make the flow harder to understand :-)
327 # The quotient of dividing by 11 is a limit to the remaining prime factors
328 # Pattern space looks like CANDIDATE\nNUMBER. When a candidate is valid,
329 # the number is divided and the candidate is tried again
330 # We have a prime factor in CANDIDATE! Print it
331 # If NUMBER = 1, we don't have any more factors
332 qw(-n -f),
333 {IN => q~
334s/.*/&;9aaaaaaaaa8aaaaaaaa7aaaaaaa6aaaaaa5aaaaa4aaaa3aaa2aa1a0/
335:encode
336s/\(a*\)\([0-9]\)\([0-9]*;.*\2\(a*\)\)/\1\1\1\1\1\1\1\1\1\1\4\3/
337tencode
338s/;.*//
339
340t7a
341
342:2
343a\
3442
345b2a
346:3
347a\
3483
349b3a
350:5
351a\
3525
353b5a
354:7
355a\
3567
357
358:7a
359s/^\(aa*\)\1\{6\}$/\1/
360t7
361:5a
362s/^\(aa*\)\1\{4\}$/\1/
363t5
364:3a
365s/^\(aa*\)\1\1$/\1/
366t3
367:2a
368s/^\(aa*\)\1$/\1/
369t2
370
371/^a$/b
372
373s/^\(aa*\)\1\{10\}/\1=&/
374
375:factor
376/^\(a\{7,\}\)=\1\1*$/! {
377 # Decrement CANDIDATE, and search again if it is still >1
378 s/^a//
379 /^aa/b factor
380
381 # Print the last remaining factor: since it is stored in the NUMBER
382 # rather than in the CANDIDATE, swap 'em: now NUMBER=1
383 s/\(.*\)=\(.*\)/\2=\1/
384}
385
386h
387s/=.*/;;0a1aa2aaa3aaaa4aaaaa5aaaaaa6aaaaaaa7aaaaaaaa8aaaaaaaaa9/
388
389:decode
390s/^\(a*\)\1\{9\}\(a\{0,9\}\)\([0-9]*;.*[^a]\2\([0-9]\)\)/\1\4\3/
391/^a/tdecode
392s/;.*//p
393
394g
395:divide
396s/^\(a*\)\(=b*\)\1/\1\2b/
397tdivide
398y/b/a/
399
400/aa$/bfactor
401~},
402
403 {IN => "2\n"
404 . "3\n"
405 . "4\n"
406 . "5\n"
407 . "8\n"
408 . "11\n"
409 . "16\n"
410 . "143\n"},
411 {OUT => "2\n"
412 . "3\n"
413 . "2\n"
414 . "2\n"
415 . "5\n"
416 . "2\n"
417 . "2\n"
418 . "2\n"
419 . "11\n"
420 . "2\n"
421 . "2\n"
422 . "2\n"
423 . "2\n"
424 . "13\n"
425 . "11\n"}
426 ],
427
428
429 ['flipcase',
430 qw(-f),
431 {IN => q|s,\([^A-Za-z]*\)\([A-Za-z]*\),\1\L\u\2,g|},
432 {IN => "09 - 02 - 2002 00.00 Tg La7 La7 -\n"
433 . "09 - 02 - 2002 00.00 Brand New Tmc 2 -\n"
434 . "09 - 02 - 2002 00.10 Tg1 Notte Rai Uno -\n"
435 . "09 - 02 - 2002 00.15 Tg Parlamento Rai Due -\n"
436 . "09 - 02 - 2002 00.15 Kung Fu - La Leggenda Continua La7 -\n"
437 . "09 - 02 - 2002 00.20 Berserk - La CoNFESSIONE Di Gatz"
438 . " Italia 1 Cartoon\n"
439 . "09 - 02 - 2002 00.20 Tg3 - Tg3 Meteo Rai TrE -\n"
440 . "09 - 02 - 2002 00.25 Meteo 2 Rai Due -\n"
441 . "09 - 02 - 2002 00.30 Appuntamento Al CinEMA RaI Due -\n"
442 . "09 - 02 - 2002 00.30 Rai Educational - Mediamente Rai Tre -\n"
443 . "09 - 02 - 2002 00.35 Profiler Rai Due -\n"
444 . "09 - 02 - 2002 00.35 Stampa OggI - Che Tempo Fa Rai Uno -\n"
445 . "09 - 02 - 2002 00.45 Rai Educational - Babele: Euro Rai Uno -\n"
446 . "09 - 02 - 2002 00.45 BollettINO Della NEVE RETE 4 News\n"
447 . "09 - 02 - 2002 00.50 STUDIO Aperto - La Giornata Italia 1 News\n"
448 . "09 - 02 - 2002 00.50 BOCCA A Bocca - 2 Tempo Rete 4 Film\n"
449 . "09 - 02 - 2002 01.00 AppuntAMENTO Al Cinema Rai Tre -\n"
450 . "09 - 02 - 2002 01.00 Music NoN Stop Tmc 2 -\n"
451 . "09 - 02 - 2002 01.00 Studio SpORT Italia 1 SporT\n"
452 . "09 - 02 - 2002 01.00 Tg 5 - Notte Canale 5 News\n"
453 . "09 - 02 - 2002 01.05 Fuori Orario. CosE (Mai) Viste Rai Tre -\n"
454 . "09 - 02 - 2002 01.15 RAINOTTE Rai Due -\n"
455 . "09 - 02 - 2002 01.15 Sottovoce Rai Uno -\n"
456 . "09 - 02 - 2002 01.15 GiOCHI Olimpici InVERNALI - CERIMONIA"
457 . " Di Apertura Rai Tre -\n"
458 . "09 - 02 - 2002 01.17 Italia Interroga Rai Due -\n"},
459 {OUT => "09 - 02 - 2002 00.00 Tg La7 La7 -\n"
460 . "09 - 02 - 2002 00.00 Brand New Tmc 2 -\n"
461 . "09 - 02 - 2002 00.10 Tg1 Notte Rai Uno -\n"
462 . "09 - 02 - 2002 00.15 Tg Parlamento Rai Due -\n"
463 . "09 - 02 - 2002 00.15 Kung Fu - La Leggenda Continua La7 -\n"
464 . "09 - 02 - 2002 00.20 Berserk - La Confessione Di Gatz"
465 . " Italia 1 Cartoon\n"
466 . "09 - 02 - 2002 00.20 Tg3 - Tg3 Meteo Rai Tre -\n"
467 . "09 - 02 - 2002 00.25 Meteo 2 Rai Due -\n"
468 . "09 - 02 - 2002 00.30 Appuntamento Al Cinema Rai Due -\n"
469 . "09 - 02 - 2002 00.30 Rai Educational - Mediamente Rai Tre -\n"
470 . "09 - 02 - 2002 00.35 Profiler Rai Due -\n"
471 . "09 - 02 - 2002 00.35 Stampa Oggi - Che Tempo Fa Rai Uno -\n"
472 . "09 - 02 - 2002 00.45 Rai Educational - Babele: Euro Rai Uno -\n"
473 . "09 - 02 - 2002 00.45 Bollettino Della Neve Rete 4 News\n"
474 . "09 - 02 - 2002 00.50 Studio Aperto - La Giornata Italia 1 News\n"
475 . "09 - 02 - 2002 00.50 Bocca A Bocca - 2 Tempo Rete 4 Film\n"
476 . "09 - 02 - 2002 01.00 Appuntamento Al Cinema Rai Tre -\n"
477 . "09 - 02 - 2002 01.00 Music Non Stop Tmc 2 -\n"
478 . "09 - 02 - 2002 01.00 Studio Sport Italia 1 Sport\n"
479 . "09 - 02 - 2002 01.00 Tg 5 - Notte Canale 5 News\n"
480 . "09 - 02 - 2002 01.05 Fuori Orario. Cose (Mai) Viste Rai Tre -\n"
481 . "09 - 02 - 2002 01.15 Rainotte Rai Due -\n"
482 . "09 - 02 - 2002 01.15 Sottovoce Rai Uno -\n"
483 . "09 - 02 - 2002 01.15 Giochi Olimpici Invernali - Cerimonia"
484 . " Di Apertura Rai Tre -\n"
485 . "09 - 02 - 2002 01.17 Italia Interroga Rai Due -\n"}
486 ],
487
488
489 ['inclib',
490 # inspired by an autoconf generated configure script.
491 qw(-e 's;lib;include;'),
492 {IN => " /usr/X11R6/lib\n"
493 . " /usr/X11R5/lib\n"
494 . " /usr/X11R4/lib\n"
495 . "\n"
496 . " /usr/lib/X11R6\n"
497 . " /usr/lib/X11R5\n"
498 . " /usr/lib/X11R4\n"
499 . "\n"
500 . " /usr/local/X11R6/lib\n"
501 . " /usr/local/X11R5/lib\n"
502 . " /usr/local/X11R4/lib\n"
503 . "\n"
504 . " /usr/local/lib/X11R6\n"
505 . " /usr/local/lib/X11R5\n"
506 . " /usr/local/lib/X11R4\n"
507 . "\n"
508 . " /usr/X11/lib\n"
509 . " /usr/lib/X11\n"
510 . " /usr/local/X11/lib\n"
511 . " /usr/local/lib/X11\n"
512 . "\n"
513 . " /usr/X386/lib\n"
514 . " /usr/x386/lib\n"
515 . " /usr/XFree86/lib/X11\n"
516 . "\n"
517 . " /usr/lib\n"
518 . " /usr/local/lib\n"
519 . " /usr/unsupported/lib\n"
520 . " /usr/athena/lib\n"
521 . " /usr/local/x11r5/lib\n"
522 . " /usr/lpp/Xamples/lib\n"
523 . "\n"
524 . " /usr/openwin/lib\n"
525 . " /usr/openwin/share/lib\n"},
526 {OUT => " /usr/X11R6/include\n"
527 . " /usr/X11R5/include\n"
528 . " /usr/X11R4/include\n"
529 . "\n"
530 . " /usr/include/X11R6\n"
531 . " /usr/include/X11R5\n"
532 . " /usr/include/X11R4\n"
533 . "\n"
534 . " /usr/local/X11R6/include\n"
535 . " /usr/local/X11R5/include\n"
536 . " /usr/local/X11R4/include\n"
537 . "\n"
538 . " /usr/local/include/X11R6\n"
539 . " /usr/local/include/X11R5\n"
540 . " /usr/local/include/X11R4\n"
541 . "\n"
542 . " /usr/X11/include\n"
543 . " /usr/include/X11\n"
544 . " /usr/local/X11/include\n"
545 . " /usr/local/include/X11\n"
546 . "\n"
547 . " /usr/X386/include\n"
548 . " /usr/x386/include\n"
549 . " /usr/XFree86/include/X11\n"
550 . "\n"
551 . " /usr/include\n"
552 . " /usr/local/include\n"
553 . " /usr/unsupported/include\n"
554 . " /usr/athena/include\n"
555 . " /usr/local/x11r5/include\n"
556 . " /usr/lpp/Xamples/include\n"
557 . "\n"
558 . " /usr/openwin/include\n"
559 . " /usr/openwin/share/include\n"}
560 ],
561
562 ['khadafy',
563 # The Khadafy test is brought to you by Scott Anderson . . .
564 qw(-f),
565 {IN => '/M[ou]\'\{0,1\}am\{1,2\}[ae]r' .
566 ' .*' .
567 '\([AEae]l[- ]\)\{0,1\}' .
568 '[GKQ]h\{0,1\}[aeu]\{1,\}\([dtz][dhz]\{0,1\}\)\{1,\}af[iy]/!d'},
569 {IN => "1) Muammar Qaddafi\n"
570 . "2) Mo'ammar Gadhafi\n"
571 . "3) Muammar Kaddafi\n"
572 . "4) Muammar Qadhafi\n"
573 . "5) Moammar El Kadhafi\n"
574 . "6) Muammar Gadafi\n"
575 . "7) Mu'ammar al-Qadafi\n"
576 . "8) Moamer El Kazzafi\n"
577 . "9) Moamar al-Gaddafi\n"
578 . "10) Mu'ammar Al Qathafi\n"
579 . "11) Muammar Al Qathafi\n"
580 . "12) Mo'ammar el-Gadhafi\n"
581 . "13) Moamar El Kadhafi\n"
582 . "14) Muammar al-Qadhafi\n"
583 . "15) Mu'ammar al-Qadhdhafi\n"
584 . "16) Mu'ammar Qadafi\n"
585 . "17) Moamar Gaddafi\n"
586 . "18) Mu'ammar Qadhdhafi\n"
587 . "19) Muammar Khaddafi\n"
588 . "20) Muammar al-Khaddafi\n"
589 . "21) Mu'amar al-Kadafi\n"
590 . "22) Muammar Ghaddafy\n"
591 . "23) Muammar Ghadafi\n"
592 . "24) Muammar Ghaddafi\n"
593 . "25) Muamar Kaddafi\n"
594 . "26) Muammar Quathafi\n"
595 . "27) Muammar Gheddafi\n"
596 . "28) Muamar Al-Kaddafi\n"
597 . "29) Moammar Khadafy\n"
598 . "30) Moammar Qudhafi\n"
599 . "31) Mu'ammar al-Qaddafi\n"
600 . "32) Mulazim Awwal Mu'ammar Muhammad Abu Minyar al-Qadhafi\n"},
601 {OUT => "1) Muammar Qaddafi\n"
602 . "2) Mo'ammar Gadhafi\n"
603 . "3) Muammar Kaddafi\n"
604 . "4) Muammar Qadhafi\n"
605 . "5) Moammar El Kadhafi\n"
606 . "6) Muammar Gadafi\n"
607 . "7) Mu'ammar al-Qadafi\n"
608 . "8) Moamer El Kazzafi\n"
609 . "9) Moamar al-Gaddafi\n"
610 . "10) Mu'ammar Al Qathafi\n"
611 . "11) Muammar Al Qathafi\n"
612 . "12) Mo'ammar el-Gadhafi\n"
613 . "13) Moamar El Kadhafi\n"
614 . "14) Muammar al-Qadhafi\n"
615 . "15) Mu'ammar al-Qadhdhafi\n"
616 . "16) Mu'ammar Qadafi\n"
617 . "17) Moamar Gaddafi\n"
618 . "18) Mu'ammar Qadhdhafi\n"
619 . "19) Muammar Khaddafi\n"
620 . "20) Muammar al-Khaddafi\n"
621 . "21) Mu'amar al-Kadafi\n"
622 . "22) Muammar Ghaddafy\n"
623 . "23) Muammar Ghadafi\n"
624 . "24) Muammar Ghaddafi\n"
625 . "25) Muamar Kaddafi\n"
626 . "26) Muammar Quathafi\n"
627 . "27) Muammar Gheddafi\n"
628 . "28) Muamar Al-Kaddafi\n"
629 . "29) Moammar Khadafy\n"
630 . "30) Moammar Qudhafi\n"
631 . "31) Mu'ammar al-Qaddafi\n"
632 . "32) Mulazim Awwal Mu'ammar Muhammad Abu Minyar al-Qadhafi\n"}
633 ],
634
635 ['linecnt',
636 qw(-e '='),
637 {IN => "A dialogue on poverty\n"
638 . "\n"
639 . " On the night when the rain beats,\n"
640 . " Driven by the wind,\n"
641 . " On the night when the snowflakes mingle\n"
642 . " With a sleety rain,\n"
643 . " I feel so helplessly cold.\n"
644 . " I nibble at a lump of salt,\n"
645 . " Sip the hot, oft-diluted dregs of _sake_;\n"
646 . " And coughing, snuffling,\n"
647 . " And stroking my scanty beard,\n"
648 . " I say in my pride,\n"
649 . " \"There's none worthy, save I!\"\n"
650 . " But I shiver still with cold.\n"
651 . " I pull up my hempen bedclothes,\n"
652 . " Wear what few sleeveless clothes I have,\n"
653 . " But cold and bitter is the night!\n"
654 . " As for those poorer than myself,\n"
655 . " Their parents must be cold and hungry,\n"
656 . " Their wives and children beg and cry.\n"
657 . " Then, how do you struggle through life?\n"
658 . "\n"
659 . " Wide as they call the heaven and earth,\n"
660 . " For me they have shrunk quite small;\n"
661 . " Bright though they call the sun and moon,\n"
662 . " They never shine for me.\n"
663 . " Is it the same with all men,\n"
664 . " Or for me alone?\n"
665 . " By rare chance I was born a man\n"
666 . " And no meaner than my fellows,\n"
667 . " But, wearing unwadded sleeveless clothes\n"
668 . " In tatters, like weeds waving in the sea,\n"
669 . " Hanging from my shoulders,\n"
670 . " And under the sunken roof,\n"
671 . " Within the leaning walls,\n"
672 . " Here I lie on straw\n"
673 . " Spread on bare earth,\n"
674 . " With my parents at my pillow,\n"
675 . " And my wife and children at my feet,\n"
676 . " All huddled in grief and tears.\n"
677 . " No fire sends up smoke\n"
678 . " At the cooking-place,\n"
679 . " And in the cauldron\n"
680 . " A spider spins its web.\n"
681 . " With not a grain to cook,\n"
682 . " We moan like the night thrush.\n"
683 . " Then, \"to cut,\" as the saying is,\n"
684 . " \"The ends of what is already too short,\"\n"
685 . " The village headman comes,\n"
686 . " With rod in hand, to our sleeping place,\n"
687 . " Growling for his dues.\n"
688 . " Must it be so hopeless --\n"
689 . " The way of this world?\n"
690 . "\n"
691 . " -- Yamanoue Okura\n"},
692 {OUT => "1\n"
693 . "A dialogue on poverty\n"
694 . "2\n"
695 . "\n"
696 . "3\n"
697 . " On the night when the rain beats,\n"
698 . "4\n"
699 . " Driven by the wind,\n"
700 . "5\n"
701 . " On the night when the snowflakes mingle\n"
702 . "6\n"
703 . " With a sleety rain,\n"
704 . "7\n"
705 . " I feel so helplessly cold.\n"
706 . "8\n"
707 . " I nibble at a lump of salt,\n"
708 . "9\n"
709 . " Sip the hot, oft-diluted dregs of _sake_;\n"
710 . "10\n"
711 . " And coughing, snuffling,\n"
712 . "11\n"
713 . " And stroking my scanty beard,\n"
714 . "12\n"
715 . " I say in my pride,\n"
716 . "13\n"
717 . " \"There's none worthy, save I!\"\n"
718 . "14\n"
719 . " But I shiver still with cold.\n"
720 . "15\n"
721 . " I pull up my hempen bedclothes,\n"
722 . "16\n"
723 . " Wear what few sleeveless clothes I have,\n"
724 . "17\n"
725 . " But cold and bitter is the night!\n"
726 . "18\n"
727 . " As for those poorer than myself,\n"
728 . "19\n"
729 . " Their parents must be cold and hungry,\n"
730 . "20\n"
731 . " Their wives and children beg and cry.\n"
732 . "21\n"
733 . " Then, how do you struggle through life?\n"
734 . "22\n"
735 . "\n"
736 . "23\n"
737 . " Wide as they call the heaven and earth,\n"
738 . "24\n"
739 . " For me they have shrunk quite small;\n"
740 . "25\n"
741 . " Bright though they call the sun and moon,\n"
742 . "26\n"
743 . " They never shine for me.\n"
744 . "27\n"
745 . " Is it the same with all men,\n"
746 . "28\n"
747 . " Or for me alone?\n"
748 . "29\n"
749 . " By rare chance I was born a man\n"
750 . "30\n"
751 . " And no meaner than my fellows,\n"
752 . "31\n"
753 . " But, wearing unwadded sleeveless clothes\n"
754 . "32\n"
755 . " In tatters, like weeds waving in the sea,\n"
756 . "33\n"
757 . " Hanging from my shoulders,\n"
758 . "34\n"
759 . " And under the sunken roof,\n"
760 . "35\n"
761 . " Within the leaning walls,\n"
762 . "36\n"
763 . " Here I lie on straw\n"
764 . "37\n"
765 . " Spread on bare earth,\n"
766 . "38\n"
767 . " With my parents at my pillow,\n"
768 . "39\n"
769 . " And my wife and children at my feet,\n"
770 . "40\n"
771 . " All huddled in grief and tears.\n"
772 . "41\n"
773 . " No fire sends up smoke\n"
774 . "42\n"
775 . " At the cooking-place,\n"
776 . "43\n"
777 . " And in the cauldron\n"
778 . "44\n"
779 . " A spider spins its web.\n"
780 . "45\n"
781 . " With not a grain to cook,\n"
782 . "46\n"
783 . " We moan like the night thrush.\n"
784 . "47\n"
785 . " Then, \"to cut,\" as the saying is,\n"
786 . "48\n"
787 . " \"The ends of what is already too short,\"\n"
788 . "49\n"
789 . " The village headman comes,\n"
790 . "50\n"
791 . " With rod in hand, to our sleeping place,\n"
792 . "51\n"
793 . " Growling for his dues.\n"
794 . "52\n"
795 . " Must it be so hopeless --\n"
796 . "53\n"
797 . " The way of this world?\n"
798 . "54\n"
799 . "\n"
800 . "55\n"
801 . " -- Yamanoue Okura\n"}
802 ],
803
804 ['manis',
805 # straight out of an autoconf-generated configure.
806 # The input should look just like the input after this is run.
807 #
808 # Protect against being on the right side of a sed subst in config.status.
809 qw(-f),
810 {IN => q(s/%@/@@/; s/@%/@@/; s/%g$/@g/; /@g$/s/[\\\\&%]/\\\\&/g;
811s/@@/%@/; s/@@/@%/; s/@g$/%g/
812)},
813 {IN => "s\%\@CFLAGS\@\%\%g\n"
814 . "s\%\@CPPFLAGS\@\%-I/\%g\n"
815 . "s\%\@CXXFLAGS\@\%-x c++\%g\n"
816 . "s\%\@DEFS\@\%\$DEFS\%g\n"
817 . "s\%\@LDFLAGS\@\%-L/usr/lib\%g\n"
818 . "s\%\@LIBS\@\%-lgnu -lbfd\%g\n"
819 . "s\%\@exec_prefix\@\%\%g\n"
820 . "s\%\@prefix\@\%\$prefix\%g\n"
821 . "s\%\@RANLIB\@\%\$RANLIB\%g\n"
822 . "s\%\@CC\@\%/usr/local/bin/gcc\%g\n"
823 . "s\%\@CPP\@\%\$CPP\%g\n"
824 . "s\%\@XCFLAGS\@\%\$XCFLAGS\%g\n"
825 . "s\%\@XINCLUDES\@\%\$XINCLUDES\%g\n"
826 . "s\%\@XLIBS\@\%\$XLIBS\%g\n"
827 . "s\%\@XPROGS\@\%\$XPROGS\%g\n"
828 . "s\%\@TCLHDIR\@\%\$TCLHDIR\%g\n"
829 . "s\%\@TCLLIB\@\%\$TCLLIB\%g\n"
830 . "s\%\@TKHDIR\@\%\$TKHDIR\%g\n"
831 . "s\%\@TKLIB\@\%\$TKLIB\%g\n"
832 . "s\%\@PTY_TYPE\@\%\$PTY_TYPE\%g\n"
833 . "s\%\@EVENT_TYPE\@\%\$EVENT_TYPE\%g\n"
834 . "s\%\@SETUID\@\%\$SETUID\%g\n"},
835 {OUT => "s\%\@CFLAGS\@\%\%g\n"
836 . "s\%\@CPPFLAGS\@\%-I/\%g\n"
837 . "s\%\@CXXFLAGS\@\%-x c++\%g\n"
838 . "s\%\@DEFS\@\%\$DEFS\%g\n"
839 . "s\%\@LDFLAGS\@\%-L/usr/lib\%g\n"
840 . "s\%\@LIBS\@\%-lgnu -lbfd\%g\n"
841 . "s\%\@exec_prefix\@\%\%g\n"
842 . "s\%\@prefix\@\%\$prefix\%g\n"
843 . "s\%\@RANLIB\@\%\$RANLIB\%g\n"
844 . "s\%\@CC\@\%/usr/local/bin/gcc\%g\n"
845 . "s\%\@CPP\@\%\$CPP\%g\n"
846 . "s\%\@XCFLAGS\@\%\$XCFLAGS\%g\n"
847 . "s\%\@XINCLUDES\@\%\$XINCLUDES\%g\n"
848 . "s\%\@XLIBS\@\%\$XLIBS\%g\n"
849 . "s\%\@XPROGS\@\%\$XPROGS\%g\n"
850 . "s\%\@TCLHDIR\@\%\$TCLHDIR\%g\n"
851 . "s\%\@TCLLIB\@\%\$TCLLIB\%g\n"
852 . "s\%\@TKHDIR\@\%\$TKHDIR\%g\n"
853 . "s\%\@TKLIB\@\%\$TKLIB\%g\n"
854 . "s\%\@PTY_TYPE\@\%\$PTY_TYPE\%g\n"
855 . "s\%\@EVENT_TYPE\@\%\$EVENT_TYPE\%g\n"
856 . "s\%\@SETUID\@\%\$SETUID\%g\n"}
857 ],
858
859 ['modulo',
860 qw(-e '0~2d;='),
861 {IN => "s\%\@CFLAGS\@\%\%g\n"
862 . "s\%\@CPPFLAGS\@\%-I/\%g\n"
863 . "s\%\@CXXFLAGS\@\%-x c++\%g\n"
864 . "s\%\@DEFS\@\%\$DEFS\%g\n"
865 . "s\%\@LDFLAGS\@\%-L/usr/lib\%g\n"
866 . "s\%\@LIBS\@\%-lgnu -lbfd\%g\n"
867 . "s\%\@exec_prefix\@\%\%g\n"
868 . "s\%\@prefix\@\%\$prefix\%g\n"
869 . "s\%\@RANLIB\@\%\$RANLIB\%g\n"
870 . "s\%\@CC\@\%/usr/local/bin/gcc\%g\n"
871 . "s\%\@CPP\@\%\$CPP\%g\n"
872 . "s\%\@XCFLAGS\@\%\$XCFLAGS\%g\n"
873 . "s\%\@XINCLUDES\@\%\$XINCLUDES\%g\n"
874 . "s\%\@XLIBS\@\%\$XLIBS\%g\n"
875 . "s\%\@XPROGS\@\%\$XPROGS\%g\n"
876 . "s\%\@TCLHDIR\@\%\$TCLHDIR\%g\n"
877 . "s\%\@TCLLIB\@\%\$TCLLIB\%g\n"
878 . "s\%\@TKHDIR\@\%\$TKHDIR\%g\n"
879 . "s\%\@TKLIB\@\%\$TKLIB\%g\n"
880 . "s\%\@PTY_TYPE\@\%\$PTY_TYPE\%g\n"
881 . "s\%\@EVENT_TYPE\@\%\$EVENT_TYPE\%g\n"
882 . "s\%\@SETUID\@\%\$SETUID\%g\n"},
883 {OUT => "1\n"
884 . "s\%\@CFLAGS\@\%\%g\n"
885 . "3\n"
886 . "s\%\@CXXFLAGS\@\%-x c++\%g\n"
887 . "5\n"
888 . "s\%\@LDFLAGS\@\%-L/usr/lib\%g\n"
889 . "7\n"
890 . "s\%\@exec_prefix\@\%\%g\n"
891 . "9\n"
892 . "s\%\@RANLIB\@\%\$RANLIB\%g\n"
893 . "11\n"
894 . "s\%\@CPP\@\%\$CPP\%g\n"
895 . "13\n"
896 . "s\%\@XINCLUDES\@\%\$XINCLUDES\%g\n"
897 . "15\n"
898 . "s\%\@XPROGS\@\%\$XPROGS\%g\n"
899 . "17\n"
900 . "s\%\@TCLLIB\@\%\$TCLLIB\%g\n"
901 . "19\n"
902 . "s\%\@TKLIB\@\%\$TKLIB\%g\n"
903 . "21\n"
904 . "s\%\@EVENT_TYPE\@\%\$EVENT_TYPE\%g\n"}
905 ],
906
907 ['middle',
908 qw(-n -e '3,5p'),
909 {IN => q( "...by imposing a tiny bit of order in a communication you are
910 translating, you are carving out a little bit of order in the
911 universe. You will never succeed. Everything will fail and come
912 to an end finally. But you have a chance to carve a little bit
913 of order and maybe even beauty out of the raw materials that
914 surround you everywhere, and I think there is no greater meaning
915 in life."
916
917 Donald L. Philippi, Oct 1930 - Jan 1993
918)},
919 {OUT =>
920q( universe. You will never succeed. Everything will fail and come
921 to an end finally. But you have a chance to carve a little bit
922 of order and maybe even beauty out of the raw materials that
923)}
924 ],
925
926 ['newline-anchor',
927 qw(-f),
928 {IN => q(N
929N
930s/^/X/g
931s/^/X/mg
932s/$/Y/g
933s/$/Y/mg
934)},
935 {IN => "a\n"
936 . "b\n"
937 . "c\n"},
938 {OUT => "XXaY\n"
939 . "XbY\n"
940 . "XcYY\n"}
941 ],
942
943 ['noeolw',
944 qw(-n -f),
945 # The sed program:
946 # generates two output files (in addition to STDOUT)
947 {IN => q(w noeolw.1out
948$ {
949 x
950 w noeolw.1out
951 x
952}
953h
9541,3w noeolw.2out
955p
956p
957)},
958 # The input file (was: noeolw.inp).
959 # NOTE: in the old test, the input file was given twice.
960 # here we specify two (identical) input files.
961 {IN => "This file is unique\n" .
962 "in that it does\n" .
963 "end in a newline."},
964 {IN => "This file is unique\n" .
965 "in that it does\n" .
966 "end in a newline."},
967
968 # The expected STDOUT (was: noeolw.good)
969 {OUT => "This file is unique\n" .
970 "This file is unique\n" .
971 "in that it does\n" .
972 "in that it does\n" .
973 "end in a newline.\n" .
974 "end in a newline.\n" .
975 "This file is unique\n" .
976 "This file is unique\n" .
977 "in that it does\n" .
978 "in that it does\n" .
979 "end in a newline.\n" .
980 "end in a newline."},
981
982 # The expected content of 'noeolw.1out' (was: noeolw.1good)
983 {CMP => [ "This file is unique\n" .
984 "in that it does\n" .
985 "end in a newline.\n" .
986 "This file is unique\n" .
987 "in that it does\n" .
988 "end in a newline.\n" .
989 "in that it does\n",
990 { 'noeolw.1out' => undef }]},
991
992 # The expected content of 'noeolw.2out' (was: noeolw.2good)
993 {CMP => [ "This file is unique\n" .
994 "in that it does\n" .
995 "end in a newline.",
996 { 'noeolw.2out' => undef }]},
997 ],
998
999 ['numsub',
1000 qw(-f),
1001 {IN => q(
1002# the first one matches, the second doesn't
10031s/foo/bar/10
10042s/foo/bar/20
1005
1006# The second line should be deleted. ssed 3.55-3.58 do not.
1007t
1008d
1009)},
1010 {IN =>
1011q(foo foo fo oo f oo foo foo foo foo foo foo foo foo foo foo foo foo foo
1012foo foo fo oo f oo foo foo foo foo foo foo foo foo foo foo foo foo foo
1013)},
1014 {OUT => "foo foo fo oo f oo foo foo foo foo "
1015 . "foo foo foo bar foo foo foo foo foo\n"}
1016 ],
1017
1018
1019 ['numsub2',
1020 qw(-n -e 's/a*/b/2'),
1021 {IN => "\n"},
1022 {OUT => ""}
1023 ],
1024
1025
1026 ['numsub3',
1027 qw(-n -e 's/^a*/b/2'),
1028 {IN => "\n"},
1029 {OUT => ""}
1030 ],
1031
1032
1033 ['numsub4',
1034 qw(-n -e 's/^a*/b/2p'),
1035 {IN => "z\n"},
1036 {OUT => ""}
1037 ],
1038
1039
1040 ['numsub5',
1041 qw(-n -e 's/a*/b/3p'),
1042 {IN => "z\n"},
1043 {OUT => ""}
1044 ],
1045
1046 ['readin',
1047 qw(-f),
1048 {IN => q(/\.$/r readin.in2
1049/too\.$/q
1050)},
1051 {AUX => { 'readin.in2' => "MOO\n" }},
1052 {IN => "``Democracy will not come today, this year,\n"
1053 . " nor ever through compromise and fear.\n"
1054 . " I have as much right as the other fellow has\n"
1055 . " to stand on my two feet and own the land.\n"
1056 . " I tire so of hearing people say\n"
1057 . " let things take their course,\n"
1058 . " tomorrow is another day.\n"
1059 . " I do not need my freedom when I'm dead.\n"
1060 . " I cannot live on tomorrow's bread.\n"
1061 . " Freedom is a strong seed\n"
1062 . " planted in a great need.\n"
1063 . " I live here, too.\n"
1064 . " I want freedom just as you.''\n"
1065 . " ``The Weary Blues'', Langston Hughes\n"},
1066 {OUT => "``Democracy will not come today, this year,\n"
1067 . " nor ever through compromise and fear.\n"
1068 . "MOO\n"
1069 . " I have as much right as the other fellow has\n"
1070 . " to stand on my two feet and own the land.\n"
1071 . "MOO\n"
1072 . " I tire so of hearing people say\n"
1073 . " let things take their course,\n"
1074 . " tomorrow is another day.\n"
1075 . "MOO\n"
1076 . " I do not need my freedom when I'm dead.\n"
1077 . "MOO\n"
1078 . " I cannot live on tomorrow's bread.\n"
1079 . "MOO\n"
1080 . " Freedom is a strong seed\n"
1081 . " planted in a great need.\n"
1082 . "MOO\n"
1083 . " I live here, too.\n"
1084 . "MOO\n"}
1085 ],
1086
1087
1088 ['sep',
1089 # inspired by an autoconf generated configure script.
1090 qw(-f),
1091 {IN => q(s%/[^/][^/]*$%%
1092s%[\/][^\/][^\/]*$%%
1093s,.*[^\/],,
1094)},
1095 {IN => "miss mary mack mack//mack/ran down/the track track track\n"
1096 . "slashes\aren't%used enough/in/casual-conversation///\n"
1097 . "possibly sentences would be more attractive if they ended"
1098 . "in two slashes//\n"},
1099 {OUT => "\n"
1100 . "///\n"
1101 . "//\n"}
1102 ],
1103
1104 ['subwrite',
1105 # test s///w option
1106 qw(-e 's/you/YoU/w subwrite.wout'),
1107 {IN => "Not some church, and not the state,\n"
1108 . "Not some dark capricious fate.\n"
1109 . "Who you are, and when you lose,\n"
1110 . "Comes only from the things you choose.\n"},
1111 # The expected STDOUT
1112 {OUT => "Not some church, and not the state,\n"
1113 . "Not some dark capricious fate.\n"
1114 . "Who YoU are, and when you lose,\n"
1115 . "Comes only from the things YoU choose.\n"},
1116 # The expected content of 'writeout.wout'
1117 {CMP => [ "Who YoU are, and when you lose,\n"
1118 . "Comes only from the things YoU choose.\n",
1119 { 'subwrite.wout' => undef }]}
1120 ],
1121
1122 ['writeout',
1123 # Test 'w' command
1124 qw(-e '/^Facts ar/w writeout.wout'),
1125 {IN => "Facts are simple and facts are straight\n"
1126 . "Facts are lazy and facts are late\n"
1127 . "Facts all come with points of view\n"
1128 . "Facts don't do what I want them to\n"},
1129 # The expected STDOUT
1130 {OUT => "Facts are simple and facts are straight\n"
1131 . "Facts are lazy and facts are late\n"
1132 . "Facts all come with points of view\n"
1133 . "Facts don't do what I want them to\n"},
1134 # The expected content of 'writeout.wout'
1135 {CMP => [ "Facts are simple and facts are straight\n"
1136 . "Facts are lazy and facts are late\n",
1137 { 'writeout.wout' => undef }]}
1138 ],
1139
1140 ['xabcx',
1141 # from the ChangeLog (Fri May 21 1993)
1142 # Regex address with custom character (\xREGEXx)
1143 qw(-e '\xfeetxs/blue/too/'),
1144 {IN => "roses are red\n"
1145 . "violets are blue\n"
1146 . "my feet are cold\n"
1147 . "your feet are blue\n"},
1148 {OUT => "roses are red\n"
1149 . "violets are blue\n"
1150 . "my feet are cold\n"
1151 . "your feet are too\n"}
1152 ],
1153
1154
1155 ['xbxcx',
1156 # from the ChangeLog (Wed Sep 5 2001)
1157 qw(-e 's/a*/x/g'),
1158 {IN => "\n"
1159 . "b\n"
1160 . "bc\n"
1161 . "bac\n"
1162 . "baac\n"
1163 . "baaac\n"
1164 . "baaaac\n"},
1165 {OUT => "x\n"
1166 . "xbx\n"
1167 . "xbxcx\n"
1168 . "xbxcx\n"
1169 . "xbxcx\n"
1170 . "xbxcx\n"
1171 . "xbxcx\n"}
1172 ],
1173
1174 ['xbxcx3',
1175 # Test s///N replacements (GNU extension)
1176 qw(-e 's/a*/x/3'),
1177 {IN => "\n"
1178 . "b\n"
1179 . "bc\n"
1180 . "bac\n"
1181 . "baac\n"
1182 . "baaac\n"
1183 . "baaaac\n"},
1184 {OUT => "\n"
1185 . "b\n"
1186 . "bcx\n"
1187 . "bacx\n"
1188 . "baacx\n"
1189 . "baaacx\n"
1190 . "baaaacx\n"}
1191 ],
1192
1193
1194 # Four backslashes (2 pairs of "\\") to pass through two interpolations:
1195 # once in Perl, then the shell command line argument.
1196 # sed will see one backslash character in the s/// command.
1197 ['bug30794_1', "s/z/\\\\x5cA/", {IN=>'z'}, {OUT => "\\A"}],
1198 ['bug30794_2', "s/z/\\\\x5c/", {IN=>'z'}, {OUT => "\\"}],
1199 ['bug30794_3', "s/z/\\\\x5c1/", {IN=>'z'}, {OUT => "\\1"}],
1200
1201 ['bug40242', q('sn\nnXn'), {IN=>'n'}, {OUT => 'X'}],
1202 );
1203
1204my $save_temps = $ENV{SAVE_TEMPS};
1205my $verbose = $ENV{VERBOSE};
1206
1207my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
1208exit $fail;
Note: See TracBrowser for help on using the repository browser.