X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-update-copyright.sh;h=60cb372661c76ae3b31eb9a11a58ecab7cafcdba;hb=5191b3546cfb6c163228c23f214e325ddf60d46f;hp=e8a71ce581ec2931ab8a02b41f21cf8c56065fa9;hpb=b49d23eb556dc8b7283315e057926b9bf428ec8d;p=gnulib.git diff --git a/tests/test-update-copyright.sh b/tests/test-update-copyright.sh index e8a71ce58..60cb37266 100755 --- a/tests/test-update-copyright.sh +++ b/tests/test-update-copyright.sh @@ -1,6 +1,6 @@ #!/bin/sh # Test suite for update-copyright. -# Copyright (C) 2009 Free Software Foundation, Inc. +# Copyright (C) 2009-2013 Free Software Foundation, Inc. # This file is part of the GNUlib Library. # # This program is free software: you can redistribute it and/or modify @@ -23,7 +23,44 @@ else compare() { cmp "$@"; } fi +# Ensure the update-copyright program gets found. +PATH=$abs_aux_dir:$PATH +export PATH + 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 + } + +# Skip this test if Perl is too old. FIXME: 5.8.0 is just a guess. +# We have a report that 5.6.1 is inadequate and that 5.8.0 works. +perl -e 'require 5.8.0' || { + echo '$0: skipping this test; Perl version is too old' 1>&2 + exit 77 +} + +# Do not let a different envvar setting perturb results. +UPDATE_COPYRIGHT_MAX_LINE_LENGTH=72 +export UPDATE_COPYRIGHT_MAX_LINE_LENGTH ## ----------------------------- ## ## Examples from documentation. ## @@ -66,11 +103,11 @@ Copyright (C) 1990-2005, 2007-2009 Acme, Inc. EOF UPDATE_COPYRIGHT_YEAR=2009 \ - update-copyright $TMP.* 1> $TMP-stdout 2> $TMP-stderr + update-copyright $TMP.? 1> $TMP-stdout 2> $TMP-stderr compare /dev/null $TMP-stdout || exit 1 compare - $TMP-stderr < $TMP-stdout 2> $TMP-stderr + update-copyright $TMP.? 1> $TMP-stdout 2> $TMP-stderr compare /dev/null $TMP-stdout || exit 1 compare - $TMP-stderr < $TMP-stdout 2> $TMP-stderr + update-copyright $TMP.? 1> $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 - $TMP-stderr < $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 /dev/null $TMP-stderr || exit 1 +compare - $TMP < $TMP.extra-text-space < $TMP.two-digit-final-is-substr-of-first < $TMP-stdout 2> $TMP-stderr compare /dev/null $TMP-stdout || exit 1 @@ -492,6 +539,9 @@ compare - $TMP.extra-text-space <