2 # Test suite for update-copyright.
3 # Copyright (C) 2009 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 <http://www.gnu.org/licenses/>.
19 TMP_BASE=update-copyright.test
21 ## ----------------------------- ##
22 ## Examples from documentation. ##
23 ## ----------------------------- ##
27 Copyright (C) 1990-2005, 2007-2009 Free Software Foundation,
31 # Copyright (c) 1990-2005, 2007-2009 Free Software
36 * Copyright (C) 90,2005,2007-2009 Free Software
41 /* Copyright (C) 1990-2005, 2007-2009 Free Software
44 Copyright (C) 1990-2005, 2007-2009 Free Software Foundation,
48 Copyright (C) 1990-2005, 2007-2009 Acme, Inc.
50 # Copyright (C) 1990-2005, 2007-2009 Free Software
54 UPDATE_COPYRIGHT_YEAR=2009 \
55 update-copyright $TMP.* 1> $TMP-stdout 2> $TMP-stderr
56 diff -u /dev/null $TMP-stdout || exit 1
57 diff -u - $TMP-stderr <<EOF || exit 1
58 $TMP.4: warning: FSF copyright statement not found
59 $TMP.5: warning: FSF copyright statement not found
61 diff -u - $TMP.1 <<EOF || exit 1
62 Copyright (C) 1990-2005, 2007-2009 Free Software Foundation,
65 diff -u - $TMP.2 <<EOF || exit 1
66 # Copyright (c) 1990-2005, 2007-2009 Free Software
69 diff -u - $TMP.3 <<EOF || exit 1
71 * Copyright (C) 90,2005,2007-2009 Free Software
75 diff -u - $TMP.4 <<EOF || exit 1
76 /* Copyright (C) 1990-2005, 2007-2009 Free Software
79 Copyright (C) 1990-2005, 2007-2009 Free Software Foundation,
82 diff -u - $TMP.5 <<EOF || exit 1
83 Copyright (C) 1990-2005, 2007-2009 Acme, Inc.
85 # Copyright (C) 1990-2005, 2007-2009 Free Software
89 UPDATE_COPYRIGHT_YEAR=2010 \
90 update-copyright $TMP.* 1> $TMP-stdout 2> $TMP-stderr
91 diff -u /dev/null $TMP-stdout || exit 1
92 diff -u - $TMP-stderr <<EOF || exit 1
93 $TMP.4: warning: FSF copyright statement not found
94 $TMP.5: warning: FSF copyright statement not found
96 diff -u - $TMP.1 <<EOF || exit 1
97 Copyright (C) 1990-2005, 2007-2010 Free Software Foundation, Inc.
99 diff -u - $TMP.2 <<EOF || exit 1
100 # Copyright (c) 1990-2005, 2007-2010 Free Software Foundation, Inc.
102 diff -u - $TMP.3 <<EOF || exit 1
104 * Copyright (C) 90, 2005, 2007-2010 Free Software Foundation, Inc.
107 diff -u - $TMP.4 <<EOF || exit 1
108 /* Copyright (C) 1990-2005, 2007-2009 Free Software
109 * Foundation, Inc. */
111 Copyright (C) 1990-2005, 2007-2009 Free Software Foundation,
114 diff -u - $TMP.5 <<EOF || exit 1
115 Copyright (C) 1990-2005, 2007-2009 Acme, Inc.
117 # Copyright (C) 1990-2005, 2007-2009 Free Software
127 TMP=$TMP_BASE-current-year
128 YEAR=`/usr/bin/perl -e 'print [localtime]->[5] + 1900'`;
130 '\" Copyright (C) 2006
131 '\" Free Software Foundation,
134 update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr
135 diff -u /dev/null $TMP-stdout || exit 1
136 diff -u /dev/null $TMP-stderr || exit 1
137 diff -u - $TMP <<EOF || exit 1
138 '\" Copyright (C) 2006, $YEAR Free Software Foundation, Inc.
142 ## ------------------ ##
143 ## Surrounding text. ##
144 ## ------------------ ##
146 TMP=$TMP_BASE-surrounding-text
149 dnl Undisturbed text.
151 dnl Free Software Foundation, Inc.
152 dnl Undisturbed text.
154 UPDATE_COPYRIGHT_YEAR=2010 \
155 update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr
156 diff -u /dev/null $TMP-stdout || exit 1
157 diff -u /dev/null $TMP-stderr || exit 1
158 diff -u - $TMP <<EOF || exit 1
160 dnl Undisturbed text.
161 dnl Copyright (C) 1989, 2010 Free Software Foundation, Inc.
162 dnl Undisturbed text.
166 ## --------------- ##
168 ## --------------- ##
170 TMP=$TMP_BASE-widest-prefix
172 #### Copyright (C) 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985,
173 #### 1986, 1987, 1988, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
174 #### 2008 Free Software Foundation, Inc.
176 UPDATE_COPYRIGHT_YEAR=2010 \
177 update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr
178 diff -u /dev/null $TMP-stdout || exit 1
179 diff -u /dev/null $TMP-stderr || exit 1
180 diff -u - $TMP <<EOF || exit 1
181 #### Copyright (C) 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984,
182 #### 1985, 1986, 1987, 1988, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
183 #### 2006, 2007, 2008, 2010 Free Software Foundation, Inc.
187 ## ------------------- ##
188 ## Prefix too large. ##
189 ## ------------------- ##
191 TMP=$TMP_BASE-prefix-too-large
193 #### Copyright (C) 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985,
194 #### 1986, 1987, 1988, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
195 #### 2008 Free Software Foundation, Inc.
197 UPDATE_COPYRIGHT_YEAR=2010 \
198 update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr
199 diff -u /dev/null $TMP-stdout || exit 1
200 diff -u - $TMP-stderr <<EOF || exit 1
201 $TMP: warning: FSF copyright statement not found
203 diff -u - $TMP <<EOF || exit 1
204 #### Copyright (C) 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985,
205 #### 1986, 1987, 1988, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
206 #### 2008 Free Software Foundation, Inc.
214 TMP=$TMP_BASE-blank-lines
216 #Copyright (C) 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985,
218 #1986, 1987, 1988, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
219 #2008 Free Software Foundation, Inc.
221 Copyright (C) 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985,
223 1986, 1987, 1988, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
224 2008 Free Software Foundation, Inc.
226 UPDATE_COPYRIGHT_YEAR=2010 \
227 update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr
228 diff -u /dev/null $TMP-stdout || exit 1
229 diff -u - $TMP-stderr <<EOF || exit 1
230 $TMP: warning: FSF copyright statement not found
232 diff -u - $TMP <<EOF || exit 1
233 #Copyright (C) 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985,
235 #1986, 1987, 1988, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
236 #2008 Free Software Foundation, Inc.
238 Copyright (C) 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985,
240 1986, 1987, 1988, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
241 2008 Free Software Foundation, Inc.
249 TMP=$TMP_BASE-leading-tabs
251 Copyright (C) 87, 88, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 98,
252 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free
253 Software Foundation, Inc.
255 UPDATE_COPYRIGHT_YEAR=2010 \
256 update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr
257 diff -u /dev/null $TMP-stdout || exit 1
258 diff -u /dev/null $TMP-stderr || exit 1
259 diff -u - $TMP <<EOF || exit 1
260 Copyright (C) 87, 88, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
261 98, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
262 2009-2010 Free Software Foundation, Inc.
266 ## -------------------- ##
267 ## Unusual whitespace. ##
268 ## -------------------- ##
270 TMP=$TMP_BASE-unusual-ws
272 # Copyright (C) 87, 88, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
273 # 98, 1999, 2000, 2001, 2002, 2003,
\f 2004, 2005, 2006, 2007, 2008,
274 # 2009 Free Software Foundation, Inc.
276 UPDATE_COPYRIGHT_YEAR=2010 \
277 update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr
278 diff -u /dev/null $TMP-stdout || exit 1
279 diff -u /dev/null $TMP-stderr || exit 1
280 diff -u - $TMP <<EOF || exit 1
281 # Copyright (C) 87, 88, 1991, 1992, 1993, 1994, 1995,
282 # 1996, 1997, 98, 1999, 2000, 2001, 2002, 2003, 2004,
283 # 2005, 2006, 2007, 2008, 2009-2010 Free Software
292 TMP=$TMP_BASE-dos-eol
293 tr @ '\015' > $TMP <<\EOF
294 Rem Copyright (C) 87, 88, 1991, 1992, 1993, 1994, 1995, 1996, 1997,@
295 Rem 98, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,@
296 Rem 2009 Free Software Foundation, Inc.@
298 UPDATE_COPYRIGHT_YEAR=2010 \
299 update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr
300 diff -u /dev/null $TMP-stdout || exit 1
301 diff -u /dev/null $TMP-stderr || exit 1
302 tr @ '\015' > $TMP-exp <<\EOF
303 Rem Copyright (C) 87, 88, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 98,@
304 Rem 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,@
305 Rem 2009-2010 Free Software Foundation, Inc.@
307 diff -u $TMP-exp $TMP || exit 1