usleep tests: Avoid failure due to known Cygwin 3.5.3 bug.
[gnulib.git] / tests / test-update-copyright.sh
blob329b5f7381408cdd7f24e4e94c92330618c699fd
1 #!/bin/sh
2 # Test suite for update-copyright.
3 # Copyright (C) 2009-2024 Free Software Foundation, Inc.
4 # This file is part of the GNUlib Library.
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.
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.
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/>.
19 diffout=`diff -u /dev/null /dev/null 2>&1`
20 if test x"$diffout" = x"" && test $? -eq 0; then
21 compare() { diff -u "$@"; }
22 else
23 compare() { cmp "$@"; }
26 # Ensure the update-copyright program gets found.
27 PATH=$abs_aux_dir:$PATH
28 export PATH
30 TMP_BASE=update-copyright.test
31 trap 'rm -f $TMP_BASE*' EXIT HUP INT QUIT TERM
33 ## --------------------------------- ##
34 ## Skip if user does not have perl. ##
35 ## --------------------------------- ##
37 TMP=$TMP_BASE
38 s=$TMP-script
39 cat <<\EOF > $s
40 #!/bin/sh
41 #! -*-perl-*-
42 # This is a prologue that allows to run a perl script as an executable
43 # on systems that are compliant to a POSIX version before POSIX:2017.
44 # On such systems, the usual invocation of an executable through execlp()
45 # or execvp() fails with ENOEXEC if it is a script that does not start
46 # with a #! line. The script interpreter mentioned in the #! line has
47 # to be /bin/sh, because on GuixSD systems that is the only program that
48 # has a fixed file name. The second line is essential for perl and is
49 # also useful for editing this file in Emacs. The next two lines below
50 # are valid code in both sh and perl. When executed by sh, they re-execute
51 # the script through the perl program found in $PATH. The '-x' option
52 # is essential as well; without it, perl would re-execute the script
53 # through /bin/sh. When executed by perl, the next two lines are a no-op.
54 eval 'exec perl -wSx -pi "$0" "$@"'
55 if 0;
57 s/a/b/
58 EOF
59 chmod a+x $s
60 echo a > $TMP-in
61 ./$s $TMP-in 2>/dev/null && test b = "`cat $TMP-in 2>/dev/null`" ||
63 printf '%s\n' "$0: skipping this test;" \
64 'your system has insufficient support for Perl' 1>&2
65 exit 77
68 # Skip this test if Perl is too old. FIXME: 5.8.0 is just a guess.
69 # We have a report that 5.6.1 is inadequate and that 5.8.0 works.
70 perl -e 'require 5.8.0' || {
71 echo "$0: skipping this test; Perl version is too old" 1>&2
72 exit 77
75 # Do not let a different envvar setting perturb results.
76 UPDATE_COPYRIGHT_MAX_LINE_LENGTH=72
77 export UPDATE_COPYRIGHT_MAX_LINE_LENGTH
79 # This assignment to 'ight' is so that data can contain strings
80 # like "Copy$ight 2024 Free Software Foundation, Inc." without being
81 # mistakenly updated by "cd .. && make update-copyright".
82 ight=right
84 ## ----------------------------- ##
85 ## Examples from documentation. ##
86 ## ----------------------------- ##
88 TMP=$TMP_BASE-ex
89 cat > $TMP-1 <<EOF
90 Copy$ight @copy$ight{} 1990-2005, 2007-2009 Free Software
91 Foundation, Inc.
92 EOF
93 cat > $TMP-2 <<EOF
94 # Copy$ight (C) 1990-2005, 2007-2009 Free Software
95 # Foundation, Inc.
96 EOF
97 cat > $TMP-3 <<EOF
99 * Copy$ight &copy; 90,2005,2007-2009
100 * Free Software Foundation, Inc.
103 cat > $TMP-4 <<EOF
104 ## Copy$ight (C) 1990-2005, 2007-2009 Free Software
105 # Foundation, Inc.
107 cat > $TMP-5 <<EOF
108 Copy$ight (C) 1990-2005, 2007-2009 Acme, Inc.
110 cat > $TMP-6 <<EOF
111 ## Copy$ight (C) 1990-2005, 2007-2009 Free Software
112 # Foundation, Inc.
114 Copy$ight (C) 1990-2005, 2007-2009 Free Software Foundation,
115 Inc.
117 cat > $TMP-7 <<EOF
118 Copy$ight (C) 1990-2005, 2007-2009 Acme, Inc.
120 # Copy$ight (C) 1990-2005, 2007-2009 Free Software
121 # Foundation, Inc.
123 cat > $TMP-8 <<EOF
124 Copy$ight (C) 2008 Free Software Foundation, Inc.
125 Copy$ight (C) 2008 Free Software Foundation, Inc.
127 cat > $TMP-9 <<EOF
128 # Copy$ight (C) 2008 Free Software Foundation, Inc.
130 Copy$ight (C) 2007 Free Software Foundation, Inc.
132 Copy$ight (C) 2008 Free Software Foundation, Inc.
135 UPDATE_COPYRIGHT_YEAR=2009 \
136 update-copyright $TMP-? 1> $TMP-stdout 2> $TMP-stderr
137 compare /dev/null $TMP-stdout || exit 1
138 compare - $TMP-stderr <<EOF || exit 1
139 $TMP-4: warning: copyright statement not found
140 $TMP-5: warning: copyright statement not found
142 compare - $TMP-1 <<EOF || exit 1
143 Copy$ight @copy$ight{} 1990-2005, 2007-2009 Free Software
144 Foundation, Inc.
146 compare - $TMP-2 <<EOF || exit 1
147 # Copy$ight (C) 1990-2005, 2007-2009 Free Software
148 # Foundation, Inc.
150 compare - $TMP-3 <<EOF || exit 1
152 * Copy$ight &copy; 90,2005,2007-2009
153 * Free Software Foundation, Inc.
156 compare - $TMP-4 <<EOF || exit 1
157 ## Copy$ight (C) 1990-2005, 2007-2009 Free Software
158 # Foundation, Inc.
160 compare - $TMP-5 <<EOF || exit 1
161 Copy$ight (C) 1990-2005, 2007-2009 Acme, Inc.
163 compare - $TMP-6 <<EOF || exit 1
164 ## Copy$ight (C) 1990-2005, 2007-2009 Free Software
165 # Foundation, Inc.
167 Copy$ight (C) 1990-2005, 2007-2009 Free Software Foundation,
168 Inc.
170 compare - $TMP-7 <<EOF || exit 1
171 Copy$ight (C) 1990-2005, 2007-2009 Acme, Inc.
173 # Copy$ight (C) 1990-2005, 2007-2009 Free Software
174 # Foundation, Inc.
176 compare - $TMP-8 <<EOF || exit 1
177 Copy$ight (C) 2008, 2009 Free Software Foundation, Inc.
178 Copy$ight (C) 2008, 2009 Free Software Foundation, Inc.
181 # Note that expecting "2007, 2009" on the third copyright line below
182 # looks wrong since the corresponding copyright year was "2008".
183 # However, the premise of this test (having inconsistent copyright dates
184 # with the same holder) is not worth handling. What happens is that the
185 # xform for the preceding line matches any list of year numbers with the
186 # same prefix and holder.
187 compare - $TMP-9 <<EOF || exit 1
188 # Copy$ight (C) 2008, 2009 Free Software Foundation, Inc.
190 Copy$ight (C) 2007, 2009 Free Software Foundation, Inc.
192 Copy$ight (C) 2007, 2009 Free Software Foundation, Inc.
195 UPDATE_COPYRIGHT_YEAR=2010 UPDATE_COPYRIGHT_USE_INTERVALS=1 \
196 update-copyright $TMP-? 1> $TMP-stdout 2> $TMP-stderr
197 compare /dev/null $TMP-stdout || exit 1
198 compare - $TMP-stderr <<EOF || exit 1
199 $TMP-4: warning: copyright statement not found
200 $TMP-5: warning: copyright statement not found
202 compare - $TMP-1 <<EOF || exit 1
203 Copy$ight @copy$ight{} 1990-2005, 2007-2010 Free Software Foundation,
204 Inc.
206 compare - $TMP-2 <<EOF || exit 1
207 # Copy$ight (C) 1990-2005, 2007-2010 Free Software Foundation, Inc.
209 compare - $TMP-3 <<EOF || exit 1
211 * Copy$ight &copy; 1990, 2005, 2007-2010 Free Software Foundation, Inc.
214 compare - $TMP-4 <<EOF || exit 1
215 ## Copy$ight (C) 1990-2005, 2007-2009 Free Software
216 # Foundation, Inc.
218 compare - $TMP-5 <<EOF || exit 1
219 Copy$ight (C) 1990-2005, 2007-2009 Acme, Inc.
221 compare - $TMP-6 <<EOF || exit 1
222 ## Copy$ight (C) 1990-2005, 2007-2009 Free Software
223 # Foundation, Inc.
225 Copy$ight (C) 1990-2005, 2007-2010 Free Software Foundation, Inc.
227 compare - $TMP-7 <<EOF || exit 1
228 Copy$ight (C) 1990-2005, 2007-2009 Acme, Inc.
230 # Copy$ight (C) 1990-2005, 2007-2010 Free Software Foundation, Inc.
233 UPDATE_COPYRIGHT_YEAR=2010 UPDATE_COPYRIGHT_FORCE=1 \
234 update-copyright $TMP-? 1> $TMP-stdout 2> $TMP-stderr
235 compare /dev/null $TMP-stdout || exit 1
236 compare - $TMP-stderr <<EOF || exit 1
237 $TMP-4: warning: copyright statement not found
238 $TMP-5: warning: copyright statement not found
240 compare - $TMP-1 <<EOF || exit 1
241 Copy$ight @copy$ight{} 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
242 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010
243 Free Software Foundation, Inc.
245 compare - $TMP-2 <<EOF || exit 1
246 # Copy$ight (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
247 # 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010 Free
248 # Software Foundation, Inc.
250 compare - $TMP-3 <<EOF || exit 1
252 * Copy$ight &copy; 1990, 2005, 2007, 2008, 2009, 2010 Free Software
253 * Foundation, Inc.
256 compare - $TMP-4 <<EOF || exit 1
257 ## Copy$ight (C) 1990-2005, 2007-2009 Free Software
258 # Foundation, Inc.
260 compare - $TMP-5 <<EOF || exit 1
261 Copy$ight (C) 1990-2005, 2007-2009 Acme, Inc.
263 compare - $TMP-6 <<EOF || exit 1
264 ## Copy$ight (C) 1990-2005, 2007-2009 Free Software
265 # Foundation, Inc.
267 Copy$ight (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
268 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010 Free
269 Software Foundation, Inc.
271 compare - $TMP-7 <<EOF || exit 1
272 Copy$ight (C) 1990-2005, 2007-2009 Acme, Inc.
274 # Copy$ight (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
275 # 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010 Free
276 # Software Foundation, Inc.
279 rm $TMP*
281 ## ------------------------ ##
282 ## Examples from man pages ##
283 ## ------------------------ ##
285 TMP=$TMP_BASE-man
286 cat > $TMP.1 <<EOF
287 '\" Copy$ight (C) 1998-2009 Free Software Foundation, Inc.
289 cat > $TMP.2 <<EOF
290 Copy$ight \(co 1998-2009 Free Software Foundation, Inc.
292 cat > $TMP.3 <<EOF
293 Copy$ight \(co 1998\(en2009 Free Software Foundation, Inc.
295 cat > $TMP.4 <<EOF
296 Copy$ight \(co 2009 Free Software Foundation, Inc.
299 UPDATE_COPYRIGHT_YEAR=2010 UPDATE_COPYRIGHT_USE_INTERVALS=1 \
300 update-copyright $TMP.? 1> $TMP-stdout 2> $TMP-stderr
301 compare /dev/null $TMP-stdout || exit 1
302 compare /dev/null $TMP-stderr || exit 1
303 compare - $TMP.1 <<EOF || exit 1
304 '\" Copy$ight (C) 1998\(en2010 Free Software Foundation, Inc.
306 compare - $TMP.2 <<EOF || exit 1
307 Copy$ight \(co 1998\(en2010 Free Software Foundation, Inc.
309 compare - $TMP.3 <<EOF || exit 1
310 Copy$ight \(co 1998\(en2010 Free Software Foundation, Inc.
312 compare - $TMP.4 <<EOF || exit 1
313 Copy$ight \(co 2009\(en2010 Free Software Foundation, Inc.
316 rm $TMP*
318 ## -------------- ##
319 ## Current year. ##
320 ## -------------- ##
322 TMP=$TMP_BASE-current-year
323 YEAR=`date +%Y`
324 cat > $TMP <<EOF
325 '\" Copy$ight (C) 2006
326 '\" Free Software Foundation,
327 '\" Inc.
329 update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr
330 compare /dev/null $TMP-stdout || exit 1
331 compare /dev/null $TMP-stderr || exit 1
332 compare - $TMP <<EOF || exit 1
333 '\" Copyright (C) 2006, $YEAR Free Software Foundation, Inc.
335 UPDATE_COPYRIGHT_USE_INTERVALS=1 \
336 update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr
337 compare /dev/null $TMP-stdout || exit 1
338 compare /dev/null $TMP-stderr || exit 1
339 compare - $TMP <<EOF || exit 1
340 '\" Copy$ight (C) 2006, $YEAR Free Software Foundation, Inc.
342 rm $TMP*
344 ## ------------------ ##
345 ## Surrounding text. ##
346 ## ------------------ ##
348 TMP=$TMP_BASE-surrounding-text
349 cat > $TMP <<EOF
350 Undisturbed text.
351 dnl Undisturbed text.
352 dnl Copy$ight (C) 89
353 dnl Free Software Foundation, Inc.
354 dnl Undisturbed text.
356 UPDATE_COPYRIGHT_YEAR=2010 \
357 update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr
358 compare /dev/null $TMP-stdout || exit 1
359 compare /dev/null $TMP-stderr || exit 1
360 compare - $TMP <<EOF || exit 1
361 Undisturbed text.
362 dnl Undisturbed text.
363 dnl Copy$ight (C) 1989, 2010 Free Software Foundation, Inc.
364 dnl Undisturbed text.
366 rm $TMP*
368 ## --------------- ##
369 ## Widest prefix. ##
370 ## --------------- ##
372 TMP=$TMP_BASE-widest-prefix
373 cat > $TMP <<EOF
374 #### Copy$ight (C) 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985,
375 #### 1986, 1987, 1988, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
376 #### 2008 Free Software Foundation, Inc.
378 UPDATE_COPYRIGHT_YEAR=2010 \
379 update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr
380 compare /dev/null $TMP-stdout || exit 1
381 compare /dev/null $TMP-stderr || exit 1
382 compare - $TMP <<EOF || exit 1
383 #### Copy$ight (C) 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984,
384 #### 1985, 1986, 1987, 1988, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
385 #### 2006, 2007, 2008, 2010 Free Software Foundation, Inc.
387 UPDATE_COPYRIGHT_YEAR=2011 UPDATE_COPYRIGHT_USE_INTERVALS=1 \
388 update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr
389 compare /dev/null $TMP-stdout || exit 1
390 compare /dev/null $TMP-stderr || exit 1
391 compare - $TMP <<EOF || exit 1
392 #### Copy$ight (C) 1976-1988, 1999-2008, 2010-2011 Free Software
393 #### Foundation, Inc.
395 rm $TMP*
397 ## ------------------- ##
398 ## Prefix too large. ##
399 ## ------------------- ##
401 TMP=$TMP_BASE-prefix-too-large
402 cat > $TMP <<EOF
403 #### Copyright (C) 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985,
404 #### 1986, 1987, 1988, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
405 #### 2008 Free Software Foundation, Inc.
407 UPDATE_COPYRIGHT_YEAR=2010 \
408 update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr
409 compare /dev/null $TMP-stdout || exit 1
410 compare - $TMP-stderr <<EOF || exit 1
411 $TMP: warning: copyright statement not found
413 compare - $TMP <<EOF || exit 1
414 #### Copy$ight (C) 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985,
415 #### 1986, 1987, 1988, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
416 #### 2008 Free Software Foundation, Inc.
418 rm $TMP*
420 ## ------------- ##
421 ## Blank lines. ##
422 ## ------------- ##
424 TMP=$TMP_BASE-blank-lines
425 cat > $TMP <<EOF
426 #Copy$ight (C) 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985,
428 #1986, 1987, 1988, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
429 #2008 Free Software Foundation, Inc.
431 Copy$ight (C) 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985,
433 1986, 1987, 1988, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
434 2008 Free Software Foundation, Inc.
436 UPDATE_COPYRIGHT_YEAR=2010 \
437 update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr
438 compare /dev/null $TMP-stdout || exit 1
439 compare - $TMP-stderr <<EOF || exit 1
440 $TMP: warning: copyright statement not found
442 compare - $TMP <<EOF || exit 1
443 #Copy$ight (C) 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985,
445 #1986, 1987, 1988, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
446 #2008 Free Software Foundation, Inc.
448 Copy$ight (C) 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985,
450 1986, 1987, 1988, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
451 2008 Free Software Foundation, Inc.
453 rm $TMP*
455 ## -------------- ##
456 ## Leading tabs. ##
457 ## -------------- ##
459 TMP=$TMP_BASE-leading-tabs
460 cat > $TMP <<EOF
461 Copy$ight (C) 87, 88, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 98,
462 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free
463 Software Foundation, Inc.
465 UPDATE_COPYRIGHT_YEAR=2010 \
466 update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr
467 compare /dev/null $TMP-stdout || exit 1
468 compare /dev/null $TMP-stderr || exit 1
469 compare - $TMP <<EOF || exit 1
470 Copy$ight (C) 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996,
471 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
472 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
474 UPDATE_COPYRIGHT_YEAR=2011 UPDATE_COPYRIGHT_USE_INTERVALS=1 \
475 update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr
476 compare /dev/null $TMP-stdout || exit 1
477 compare /dev/null $TMP-stderr || exit 1
478 compare - $TMP <<EOF || exit 1
479 Copy$ight (C) 1987-1988, 1991-2011 Free Software Foundation,
480 Inc.
482 rm $TMP*
484 ## -------------------- ##
485 ## Unusual whitespace. ##
486 ## -------------------- ##
488 TMP=$TMP_BASE-unusual-ws
489 cat > $TMP <<EOF
490 # Copy$ight (C) 87-88, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
491 # 98, 1999, 2000, 2001, 2002, 2003, \f 2004, 2005, 2006, 2007, 2008,
492 # 2009 Free Software Foundation, Inc.
494 UPDATE_COPYRIGHT_YEAR=2010 \
495 update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr
496 compare /dev/null $TMP-stdout || exit 1
497 compare /dev/null $TMP-stderr || exit 1
498 compare - $TMP <<EOF || exit 1
499 # Copy$ight (C) 1987, 1988, 1991, 1992, 1993, 1994,
500 # 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
501 # 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
502 # Foundation, Inc.
504 UPDATE_COPYRIGHT_YEAR=2011 UPDATE_COPYRIGHT_USE_INTERVALS=1 \
505 update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr
506 compare /dev/null $TMP-stdout || exit 1
507 compare /dev/null $TMP-stderr || exit 1
508 compare - $TMP <<EOF || exit 1
509 # Copy$ight (C) 1987-1988, 1991-2011 Free Software
510 # Foundation, Inc.
512 UPDATE_COPYRIGHT_YEAR=2011 UPDATE_COPYRIGHT_USE_INTERVALS=2 \
513 UPDATE_COPYRIGHT_FORCE=1 update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr
514 compare /dev/null $TMP-stdout || exit 1
515 compare /dev/null $TMP-stderr || exit 1
516 compare - $TMP <<EOF || exit 1
517 # Copy$ight (C) 1987-2011 Free Software Foundation, Inc.
519 rm $TMP*
521 ## --------- ##
522 ## DOS EOL. ##
523 ## --------- ##
525 TMP=$TMP_BASE-dos-eol
526 tr @ '\015' > $TMP <<EOF
527 Rem Copy$ight (C) 87, 88, 1991, 1992, 1993, 1994, 1995, 1996, 1997,@
528 Rem 98, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,@
529 Rem 2009 Free Software Foundation, Inc.@
531 UPDATE_COPYRIGHT_YEAR=2010 \
532 update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr
533 compare /dev/null $TMP-stdout || exit 1
534 compare /dev/null $TMP-stderr || exit 1
535 tr @ '\015' > $TMP-exp <<EOF
536 Rem Copy$ight (C) 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996, 1997,@
537 Rem 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,@
538 Rem 2009, 2010 Free Software Foundation, Inc.@
540 compare $TMP-exp $TMP || exit 1
541 rm $TMP*
543 ## --------------- ##
544 ## Omitted "(C)". ##
545 ## --------------- ##
547 TMP=$TMP_BASE-omitted-circle-c
548 cat > $TMP <<EOF
549 Copy$ight 87, 88, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
550 98, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
551 2009 Free Software Foundation, Inc.
553 UPDATE_COPYRIGHT_YEAR=2010 \
554 update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr
555 compare /dev/null $TMP-stdout || exit 1
556 compare /dev/null $TMP-stderr || exit 1
557 compare - $TMP <<EOF || exit 1
558 Copy$ight 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
559 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
560 Free Software Foundation, Inc.
562 rm $TMP*
564 ## ------------------ ##
565 ## C-style comments. ##
566 ## ------------------ ##
568 TMP=$TMP_BASE-c-style-comments
569 cat > $TMP.star <<EOF
570 /* Copy$ight 87, 88, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
571 * 98, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
572 * 2009 Free Software Foundation, Inc. */
574 cat > $TMP.space <<EOF
575 /*Copy$ight 87, 88, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
576 98, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
577 2009 Free Software Foundation, Inc. */
579 cat > $TMP.single-line <<EOF
580 /* Copy$ight 87, 1991, 1992 Free Software Foundation, Inc. */
582 cat > $TMP.single-line-wrapped <<EOF
583 /* Copy$ight 1988, 1991, 1992, 1993 Free Software Foundation, Inc. */
585 cat > $TMP.extra-text-star <<EOF
586 /* Copy$ight 1987, 1988, 1991, 1992 Free Software Foundation, Inc. End
587 * More comments. */
589 cat > $TMP.extra-text-space <<EOF
590 /* Copy$ight 1987, 1988, 1991, 1992 Free Software Foundation, Inc. ***
591 * End of comments. */
593 cat > $TMP.two-digit-final-is-substr-of-first <<EOF
594 /* Copy$ight 1991, 99 Free Software Foundation, Inc. */
596 UPDATE_COPYRIGHT_YEAR=2010 \
597 update-copyright $TMP.* 1> $TMP-stdout 2> $TMP-stderr
598 compare /dev/null $TMP-stdout || exit 1
599 compare /dev/null $TMP-stderr || exit 1
600 compare - $TMP.star <<EOF || exit 1
601 /* Copy$ight 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
602 * 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
603 * 2009, 2010 Free Software Foundation, Inc. */
605 compare - $TMP.space <<EOF || exit 1
606 /*Copy$ight 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
607 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
608 2009, 2010 Free Software Foundation, Inc. */
610 compare - $TMP.single-line <<EOF || exit 1
611 /* Copy$ight 1987, 1991, 1992, 2010 Free Software Foundation, Inc. */
613 compare - $TMP.single-line-wrapped <<EOF || exit 1
614 /* Copy$ight 1988, 1991, 1992, 1993, 2010 Free Software Foundation,
615 * Inc. */
617 compare - $TMP.extra-text-star <<EOF || exit 1
618 /* Copy$ight 1987, 1988, 1991, 1992, 2010 Free Software Foundation,
619 * Inc. End
620 * More comments. */
622 compare - $TMP.extra-text-space <<EOF || exit 1
623 /* Copy$ight 1987, 1988, 1991, 1992, 2010 Free Software Foundation,
624 Inc. ***
625 * End of comments. */
627 compare - $TMP.two-digit-final-is-substr-of-first <<EOF || exit 1
628 /* Copy$ight 1991, 1999, 2010 Free Software Foundation, Inc. */
630 rm $TMP*
632 exit 0