Bump to m4 1.4.19
[platform/upstream/m4.git] / tests / test-update-copyright.sh
1 #!/bin/sh
2 # Test suite for update-copyright.
3 # Copyright (C) 2009-2021 Free Software Foundation, Inc.
4 # This file is part of the GNUlib Library.
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
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 "$@"; }
24 fi
25
26 # Ensure the update-copyright program gets found.
27 PATH=$abs_aux_dir:$PATH
28 export PATH
29
30 TMP_BASE=update-copyright.test
31 trap 'rm -f $TMP_BASE*' 0 1 2 3 15
32
33 ## --------------------------------- ##
34 ## Skip if user does not have perl.  ##
35 ## --------------------------------- ##
36
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;
56
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`" ||
62   {
63     printf '%s\n' "$0: skipping this test;" \
64       'your system has insufficient support for Perl' 1>&2
65     exit 77
66   }
67
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
73 }
74
75 # Do not let a different envvar setting perturb results.
76 UPDATE_COPYRIGHT_MAX_LINE_LENGTH=72
77 export UPDATE_COPYRIGHT_MAX_LINE_LENGTH
78
79 ## ----------------------------- ##
80 ## Examples from documentation.  ##
81 ## ----------------------------- ##
82
83 TMP=$TMP_BASE-ex
84 cat > $TMP.1 <<EOF
85 Copyright @copyright{} 1990-2005, 2007-2009 Free Software
86 Foundation, Inc.
87 EOF
88 cat > $TMP.2 <<EOF
89 # Copyright (C) 1990-2005, 2007-2009 Free Software
90 # Foundation, Inc.
91 EOF
92 cat > $TMP.3 <<EOF
93 /*
94  * Copyright &copy; 90,2005,2007-2009
95  * Free Software Foundation, Inc.
96  */
97 EOF
98 cat > $TMP.4 <<EOF
99 ## Copyright (C) 1990-2005, 2007-2009 Free Software
100 #  Foundation, Inc.
101 EOF
102 cat > $TMP.5 <<EOF
103 Copyright (C) 1990-2005, 2007-2009 Acme, Inc.
104 EOF
105 cat > $TMP.6 <<EOF
106 ## Copyright (C) 1990-2005, 2007-2009 Free Software
107 #  Foundation, Inc.
108
109 Copyright (C) 1990-2005, 2007-2009 Free Software Foundation,
110 Inc.
111 EOF
112 cat > $TMP.7 <<EOF
113 Copyright (C) 1990-2005, 2007-2009 Acme, Inc.
114
115 # Copyright (C) 1990-2005, 2007-2009 Free Software
116 # Foundation, Inc.
117 EOF
118
119 UPDATE_COPYRIGHT_YEAR=2009 \
120   update-copyright $TMP.? 1> $TMP-stdout 2> $TMP-stderr
121 compare /dev/null $TMP-stdout || exit 1
122 compare - $TMP-stderr <<EOF || exit 1
123 $TMP.4: warning: copyright statement not found
124 $TMP.5: warning: copyright statement not found
125 EOF
126 compare - $TMP.1 <<EOF || exit 1
127 Copyright @copyright{} 1990-2005, 2007-2009 Free Software
128 Foundation, Inc.
129 EOF
130 compare - $TMP.2 <<EOF || exit 1
131 # Copyright (C) 1990-2005, 2007-2009 Free Software
132 # Foundation, Inc.
133 EOF
134 compare - $TMP.3 <<EOF || exit 1
135 /*
136  * Copyright &copy; 90,2005,2007-2009
137  * Free Software Foundation, Inc.
138  */
139 EOF
140 compare - $TMP.4 <<EOF || exit 1
141 ## Copyright (C) 1990-2005, 2007-2009 Free Software
142 #  Foundation, Inc.
143 EOF
144 compare - $TMP.5 <<EOF || exit 1
145 Copyright (C) 1990-2005, 2007-2009 Acme, Inc.
146 EOF
147 compare - $TMP.6 <<EOF || exit 1
148 ## Copyright (C) 1990-2005, 2007-2009 Free Software
149 #  Foundation, Inc.
150
151 Copyright (C) 1990-2005, 2007-2009 Free Software Foundation,
152 Inc.
153 EOF
154 compare - $TMP.7 <<EOF || exit 1
155 Copyright (C) 1990-2005, 2007-2009 Acme, Inc.
156
157 # Copyright (C) 1990-2005, 2007-2009 Free Software
158 # Foundation, Inc.
159 EOF
160
161 UPDATE_COPYRIGHT_YEAR=2010 UPDATE_COPYRIGHT_USE_INTERVALS=1 \
162   update-copyright $TMP.? 1> $TMP-stdout 2> $TMP-stderr
163 compare /dev/null $TMP-stdout || exit 1
164 compare - $TMP-stderr <<EOF || exit 1
165 $TMP.4: warning: copyright statement not found
166 $TMP.5: warning: copyright statement not found
167 EOF
168 compare - $TMP.1 <<EOF || exit 1
169 Copyright @copyright{} 1990-2005, 2007-2010 Free Software Foundation,
170 Inc.
171 EOF
172 compare - $TMP.2 <<EOF || exit 1
173 # Copyright (C) 1990-2005, 2007-2010 Free Software Foundation, Inc.
174 EOF
175 compare - $TMP.3 <<EOF || exit 1
176 /*
177  * Copyright &copy; 1990, 2005, 2007-2010 Free Software Foundation, Inc.
178  */
179 EOF
180 compare - $TMP.4 <<EOF || exit 1
181 ## Copyright (C) 1990-2005, 2007-2009 Free Software
182 #  Foundation, Inc.
183 EOF
184 compare - $TMP.5 <<EOF || exit 1
185 Copyright (C) 1990-2005, 2007-2009 Acme, Inc.
186 EOF
187 compare - $TMP.6 <<EOF || exit 1
188 ## Copyright (C) 1990-2005, 2007-2009 Free Software
189 #  Foundation, Inc.
190
191 Copyright (C) 1990-2005, 2007-2010 Free Software Foundation, Inc.
192 EOF
193 compare - $TMP.7 <<EOF || exit 1
194 Copyright (C) 1990-2005, 2007-2009 Acme, Inc.
195
196 # Copyright (C) 1990-2005, 2007-2010 Free Software Foundation, Inc.
197 EOF
198
199 UPDATE_COPYRIGHT_YEAR=2010 UPDATE_COPYRIGHT_FORCE=1 \
200   update-copyright $TMP.? 1> $TMP-stdout 2> $TMP-stderr
201 compare /dev/null $TMP-stdout || exit 1
202 compare - $TMP-stderr <<EOF || exit 1
203 $TMP.4: warning: copyright statement not found
204 $TMP.5: warning: copyright statement not found
205 EOF
206 compare - $TMP.1 <<EOF || exit 1
207 Copyright @copyright{} 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
208 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010
209 Free Software Foundation, Inc.
210 EOF
211 compare - $TMP.2 <<EOF || exit 1
212 # Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
213 # 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010 Free
214 # Software Foundation, Inc.
215 EOF
216 compare - $TMP.3 <<EOF || exit 1
217 /*
218  * Copyright &copy; 1990, 2005, 2007, 2008, 2009, 2010 Free Software
219  * Foundation, Inc.
220  */
221 EOF
222 compare - $TMP.4 <<EOF || exit 1
223 ## Copyright (C) 1990-2005, 2007-2009 Free Software
224 #  Foundation, Inc.
225 EOF
226 compare - $TMP.5 <<EOF || exit 1
227 Copyright (C) 1990-2005, 2007-2009 Acme, Inc.
228 EOF
229 compare - $TMP.6 <<EOF || exit 1
230 ## Copyright (C) 1990-2005, 2007-2009 Free Software
231 #  Foundation, Inc.
232
233 Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
234 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010 Free
235 Software Foundation, Inc.
236 EOF
237 compare - $TMP.7 <<EOF || exit 1
238 Copyright (C) 1990-2005, 2007-2009 Acme, Inc.
239
240 # Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
241 # 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010 Free
242 # Software Foundation, Inc.
243 EOF
244
245 rm $TMP*
246
247 ## -------------- ##
248 ## Current year.  ##
249 ## -------------- ##
250
251 TMP=$TMP_BASE-current-year
252 YEAR=`date +%Y`
253 cat > $TMP <<EOF
254 '\" Copyright (C) 2006
255 '\" Free Software Foundation,
256 '\" Inc.
257 EOF
258 update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr
259 compare /dev/null $TMP-stdout || exit 1
260 compare /dev/null $TMP-stderr || exit 1
261 compare - $TMP <<EOF || exit 1
262 '\" Copyright (C) 2006, $YEAR Free Software Foundation, Inc.
263 EOF
264 UPDATE_COPYRIGHT_USE_INTERVALS=1 \
265   update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr
266 compare /dev/null $TMP-stdout || exit 1
267 compare /dev/null $TMP-stderr || exit 1
268 compare - $TMP <<EOF || exit 1
269 '\" Copyright (C) 2006, $YEAR Free Software Foundation, Inc.
270 EOF
271 rm $TMP*
272
273 ## ------------------ ##
274 ## Surrounding text.  ##
275 ## ------------------ ##
276
277 TMP=$TMP_BASE-surrounding-text
278 cat > $TMP <<EOF
279     Undisturbed text.
280 dnl Undisturbed text.
281 dnl Copyright (C) 89
282 dnl Free Software Foundation, Inc.
283 dnl   Undisturbed text.
284 EOF
285 UPDATE_COPYRIGHT_YEAR=2010 \
286   update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr
287 compare /dev/null $TMP-stdout || exit 1
288 compare /dev/null $TMP-stderr || exit 1
289 compare - $TMP <<EOF || exit 1
290     Undisturbed text.
291 dnl Undisturbed text.
292 dnl Copyright (C) 1989, 2010 Free Software Foundation, Inc.
293 dnl   Undisturbed text.
294 EOF
295 rm $TMP*
296
297 ## --------------- ##
298 ## Widest prefix.  ##
299 ## --------------- ##
300
301 TMP=$TMP_BASE-widest-prefix
302 cat > $TMP <<EOF
303 #### Copyright (C) 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985,
304 #### 1986, 1987, 1988, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
305 #### 2008 Free Software Foundation, Inc.
306 EOF
307 UPDATE_COPYRIGHT_YEAR=2010 \
308   update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr
309 compare /dev/null $TMP-stdout || exit 1
310 compare /dev/null $TMP-stderr || exit 1
311 compare - $TMP <<EOF || exit 1
312 #### Copyright (C) 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984,
313 #### 1985, 1986, 1987, 1988, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
314 #### 2006, 2007, 2008, 2010 Free Software Foundation, Inc.
315 EOF
316 UPDATE_COPYRIGHT_YEAR=2011 UPDATE_COPYRIGHT_USE_INTERVALS=1 \
317   update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr
318 compare /dev/null $TMP-stdout || exit 1
319 compare /dev/null $TMP-stderr || exit 1
320 compare - $TMP <<EOF || exit 1
321 #### Copyright (C) 1976-1988, 1999-2008, 2010-2011 Free Software
322 #### Foundation, Inc.
323 EOF
324 rm $TMP*
325
326 ## ------------------- ##
327 ## Prefix too large.  ##
328 ## ------------------- ##
329
330 TMP=$TMP_BASE-prefix-too-large
331 cat > $TMP <<EOF
332 ####  Copyright (C) 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985,
333 ####  1986, 1987, 1988, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
334 ####  2008 Free Software Foundation, Inc.
335 EOF
336 UPDATE_COPYRIGHT_YEAR=2010 \
337   update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr
338 compare /dev/null $TMP-stdout || exit 1
339 compare - $TMP-stderr <<EOF || exit 1
340 $TMP: warning: copyright statement not found
341 EOF
342 compare - $TMP <<EOF || exit 1
343 ####  Copyright (C) 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985,
344 ####  1986, 1987, 1988, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
345 ####  2008 Free Software Foundation, Inc.
346 EOF
347 rm $TMP*
348
349 ## ------------- ##
350 ## Blank lines.  ##
351 ## ------------- ##
352
353 TMP=$TMP_BASE-blank-lines
354 cat > $TMP <<EOF
355 #Copyright (C) 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985,
356 #
357 #1986, 1987, 1988, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
358 #2008 Free Software Foundation, Inc.
359
360 Copyright (C) 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985,
361
362 1986, 1987, 1988, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
363 2008 Free Software Foundation, Inc.
364 EOF
365 UPDATE_COPYRIGHT_YEAR=2010 \
366   update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr
367 compare /dev/null $TMP-stdout || exit 1
368 compare - $TMP-stderr <<EOF || exit 1
369 $TMP: warning: copyright statement not found
370 EOF
371 compare - $TMP <<EOF || exit 1
372 #Copyright (C) 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985,
373 #
374 #1986, 1987, 1988, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
375 #2008 Free Software Foundation, Inc.
376
377 Copyright (C) 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985,
378
379 1986, 1987, 1988, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
380 2008 Free Software Foundation, Inc.
381 EOF
382 rm $TMP*
383
384 ## -------------- ##
385 ## Leading tabs.  ##
386 ## -------------- ##
387
388 TMP=$TMP_BASE-leading-tabs
389 cat > $TMP <<EOF
390         Copyright (C) 87, 88, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 98,
391          1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free
392         Software Foundation, Inc.
393 EOF
394 UPDATE_COPYRIGHT_YEAR=2010 \
395   update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr
396 compare /dev/null $TMP-stdout || exit 1
397 compare /dev/null $TMP-stderr || exit 1
398 compare - $TMP <<EOF || exit 1
399         Copyright (C) 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996,
400         1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
401         2007, 2008, 2009, 2010 Free Software Foundation, Inc.
402 EOF
403 UPDATE_COPYRIGHT_YEAR=2011 UPDATE_COPYRIGHT_USE_INTERVALS=1 \
404   update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr
405 compare /dev/null $TMP-stdout || exit 1
406 compare /dev/null $TMP-stderr || exit 1
407 compare - $TMP <<EOF || exit 1
408         Copyright (C) 1987-1988, 1991-2011 Free Software Foundation,
409         Inc.
410 EOF
411 rm $TMP*
412
413 ## -------------------- ##
414 ## Unusual whitespace.  ##
415 ## -------------------- ##
416
417 TMP=$TMP_BASE-unusual-ws
418 cat > $TMP <<EOF
419                 # Copyright (C) 87-88, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
420                 # 98, 1999, 2000, 2001, 2002, 2003,             \f         2004, 2005, 2006, 2007, 2008,
421                 # 2009 Free Software Foundation, Inc.
422 EOF
423 UPDATE_COPYRIGHT_YEAR=2010 \
424   update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr
425 compare /dev/null $TMP-stdout || exit 1
426 compare /dev/null $TMP-stderr || exit 1
427 compare - $TMP <<EOF || exit 1
428                 # Copyright (C) 1987, 1988, 1991, 1992, 1993, 1994,
429                 # 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
430                 # 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
431                 # Foundation, Inc.
432 EOF
433 UPDATE_COPYRIGHT_YEAR=2011 UPDATE_COPYRIGHT_USE_INTERVALS=1 \
434   update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr
435 compare /dev/null $TMP-stdout || exit 1
436 compare /dev/null $TMP-stderr || exit 1
437 compare - $TMP <<EOF || exit 1
438                 # Copyright (C) 1987-1988, 1991-2011 Free Software
439                 # Foundation, Inc.
440 EOF
441 UPDATE_COPYRIGHT_YEAR=2011 UPDATE_COPYRIGHT_USE_INTERVALS=2 \
442   UPDATE_COPYRIGHT_FORCE=1 update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr
443 compare /dev/null $TMP-stdout || exit 1
444 compare /dev/null $TMP-stderr || exit 1
445 compare - $TMP <<EOF || exit 1
446                 # Copyright (C) 1987-2011 Free Software Foundation, Inc.
447 EOF
448 rm $TMP*
449
450 ## --------- ##
451 ## DOS EOL.  ##
452 ## --------- ##
453
454 TMP=$TMP_BASE-dos-eol
455 tr @ '\015' > $TMP <<\EOF
456 Rem Copyright (C) 87, 88, 1991, 1992, 1993, 1994, 1995, 1996, 1997,@
457 Rem 98, 1999, 2000, 2001, 2002, 2003,  2004, 2005, 2006, 2007, 2008,@
458 Rem 2009 Free Software Foundation, Inc.@
459 EOF
460 UPDATE_COPYRIGHT_YEAR=2010 \
461   update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr
462 compare /dev/null $TMP-stdout || exit 1
463 compare /dev/null $TMP-stderr || exit 1
464 tr @ '\015' > $TMP-exp <<\EOF
465 Rem Copyright (C) 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996, 1997,@
466 Rem 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,@
467 Rem 2009, 2010 Free Software Foundation, Inc.@
468 EOF
469 compare $TMP-exp $TMP || exit 1
470 rm $TMP*
471
472 ## --------------- ##
473 ## Omitted "(C)".  ##
474 ## --------------- ##
475
476 TMP=$TMP_BASE-omitted-circle-c
477 cat > $TMP <<EOF
478   Copyright 87, 88, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
479   98, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
480   2009 Free Software Foundation, Inc.
481 EOF
482 UPDATE_COPYRIGHT_YEAR=2010 \
483   update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr
484 compare /dev/null $TMP-stdout || exit 1
485 compare /dev/null $TMP-stderr || exit 1
486 compare - $TMP <<EOF || exit 1
487   Copyright 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
488   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
489   Free Software Foundation, Inc.
490 EOF
491 rm $TMP*
492
493 ## ------------------ ##
494 ## C-style comments.  ##
495 ## ------------------ ##
496
497 TMP=$TMP_BASE-c-style-comments
498 cat > $TMP.star <<EOF
499 /*  Copyright 87, 88, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
500  *  98, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
501  *  2009 Free Software Foundation, Inc.  */
502 EOF
503 cat > $TMP.space <<EOF
504   /*Copyright 87, 88, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
505     98, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
506     2009 Free Software Foundation, Inc.  */
507 EOF
508 cat > $TMP.single-line <<EOF
509 /*   Copyright 87, 1991, 1992 Free Software Foundation, Inc.  */
510 EOF
511 cat > $TMP.single-line-wrapped <<EOF
512  /* Copyright 1988, 1991, 1992, 1993 Free Software Foundation, Inc.  */
513 EOF
514 cat > $TMP.extra-text-star <<EOF
515  /* Copyright 1987, 1988, 1991, 1992 Free Software Foundation, Inc.  End
516   * More comments.  */
517 EOF
518 cat > $TMP.extra-text-space <<EOF
519  /* Copyright 1987, 1988, 1991, 1992 Free Software Foundation, Inc. ***
520     * End of comments. */
521 EOF
522 cat > $TMP.two-digit-final-is-substr-of-first <<EOF
523  /* Copyright 1991, 99 Free Software Foundation, Inc. */
524 EOF
525 UPDATE_COPYRIGHT_YEAR=2010 \
526   update-copyright $TMP.* 1> $TMP-stdout 2> $TMP-stderr
527 compare /dev/null $TMP-stdout || exit 1
528 compare /dev/null $TMP-stderr || exit 1
529 compare - $TMP.star <<EOF || exit 1
530 /*  Copyright 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
531  *  1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
532  *  2009, 2010 Free Software Foundation, Inc.  */
533 EOF
534 compare - $TMP.space <<EOF || exit 1
535   /*Copyright 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
536     1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
537     2009, 2010 Free Software Foundation, Inc.  */
538 EOF
539 compare - $TMP.single-line <<EOF || exit 1
540 /*   Copyright 1987, 1991, 1992, 2010 Free Software Foundation, Inc.  */
541 EOF
542 compare - $TMP.single-line-wrapped <<EOF || exit 1
543  /* Copyright 1988, 1991, 1992, 1993, 2010 Free Software Foundation,
544   * Inc.  */
545 EOF
546 compare - $TMP.extra-text-star <<EOF || exit 1
547  /* Copyright 1987, 1988, 1991, 1992, 2010 Free Software Foundation,
548   * Inc.  End
549   * More comments.  */
550 EOF
551 compare - $TMP.extra-text-space <<EOF || exit 1
552  /* Copyright 1987, 1988, 1991, 1992, 2010 Free Software Foundation,
553     Inc. ***
554     * End of comments. */
555 EOF
556 compare - $TMP.two-digit-final-is-substr-of-first <<EOF || exit 1
557  /* Copyright 1991, 1999, 2010 Free Software Foundation, Inc. */
558 EOF
559 rm $TMP*
560
561 exit 0