X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-update-copyright.sh;h=d5552395095636086596e59ef0d2dc9000ae0144;hb=acf2fa819ee5f1c5acb832dd4b9ebe52a3985699;hp=9997df488e01c2586b2a3ed50b4689704690e255;hpb=db430480e121625e8a1e5fac54157887aa08fe80;p=gnulib.git diff --git a/tests/test-update-copyright.sh b/tests/test-update-copyright.sh index 9997df488..d55523950 100755 --- a/tests/test-update-copyright.sh +++ b/tests/test-update-copyright.sh @@ -24,6 +24,28 @@ else fi TMP_BASE=update-copyright.test +trap 'rm -f $TMP_BASE*' 0 1 2 3 15 + +## --------------------------------- ## +## Skip if user does not have perl. ## +## --------------------------------- ## + +TMP=$TMP_BASE +s=$TMP-script +cat <<\EOF > $s +eval '(exit $?0)' && eval 'exec perl -wS -0777 -pi "$0" ${1+"$@"}' + & eval 'exec perl -wS -0777 -pi "$0" $argv:q' + if 0; +s/a/b/ +EOF +chmod a+x $s +echo a > $TMP-in +./$s $TMP-in 2>/dev/null && test b = "`cat $TMP-in 2>/dev/null`" || + { + printf '%s\n' "$0: skipping this test;" \ + 'your system has insufficient support for Perl' 1>&2 + exit 77 + } ## ----------------------------- ## ## Examples from documentation. ## @@ -65,6 +87,7 @@ Copyright (C) 1990-2005, 2007-2009 Acme, Inc. # Foundation, Inc. EOF +rm -f $TMP.*.bak UPDATE_COPYRIGHT_YEAR=2009 \ update-copyright $TMP.* 1> $TMP-stdout 2> $TMP-stderr compare /dev/null $TMP-stdout || exit 1 @@ -107,7 +130,8 @@ Copyright (C) 1990-2005, 2007-2009 Acme, Inc. # Foundation, Inc. EOF -UPDATE_COPYRIGHT_YEAR=2010 \ +rm -f $TMP.*.bak +UPDATE_COPYRIGHT_YEAR=2010 UPDATE_COPYRIGHT_USE_INTERVALS=1 \ update-copyright $TMP.* 1> $TMP-stdout 2> $TMP-stderr compare /dev/null $TMP-stdout || exit 1 compare - $TMP-stderr < $TMP-stdout 2> $TMP-stderr +compare /dev/null $TMP-stdout || exit 1 +compare - $TMP-stderr <[5] + 1900'`; +YEAR=`date +%Y` cat > $TMP < $TMP-stdout 2> $TMP-stderr +compare /dev/null $TMP-stdout || exit 1 +compare /dev/null $TMP-stderr || exit 1 +compare - $TMP < $TMP-stdout 2> $TMP-stderr +compare /dev/null $TMP-stdout || exit 1 +compare /dev/null $TMP-stderr || exit 1 +compare - $TMP < $TMP-stdout 2> $TMP-stderr +compare /dev/null $TMP-stdout || exit 1 +compare /dev/null $TMP-stderr || exit 1 +compare - $TMP < $TMP < $TMP-stdout 2> $TMP-stderr +compare /dev/null $TMP-stdout || exit 1 +compare /dev/null $TMP-stderr || exit 1 +compare - $TMP < $TMP-exp <<\EOF -Rem Copyright (C) 87, 88, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 98,@ -Rem 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,@ -Rem 2009-2010 Free Software Foundation, Inc.@ +Rem Copyright (C) 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996, 1997,@ +Rem 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,@ +Rem 2009, 2010 Free Software Foundation, Inc.@ EOF compare $TMP-exp $TMP || exit 1 rm $TMP* @@ -349,9 +451,9 @@ UPDATE_COPYRIGHT_YEAR=2010 \ compare /dev/null $TMP-stdout || exit 1 compare /dev/null $TMP-stderr || exit 1 compare - $TMP < $TMP.space < $TMP.single-line < $TMP.single-line-wrapped <