| 1 |
# t390 --- ident |
| 2 |
# |
| 3 |
# Copyright (C) 2010-2022 Thien-Thi Nguyen |
| 4 |
# |
| 5 |
# This program is free software: you can redistribute it and/or |
| 6 |
# modify it under the terms of the GNU General Public License as |
| 7 |
# published by the Free Software Foundation, either version 3 of |
| 8 |
# the License, or (at your option) any later version. |
| 9 |
# |
| 10 |
# This program is distributed in the hope that it will be useful, |
| 11 |
# but WITHOUT ANY WARRANTY; without even the implied warranty |
| 12 |
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 13 |
# See the GNU General Public License for more details. |
| 14 |
# |
| 15 |
# You should have received a copy of the GNU General Public License |
| 16 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 |
|
| 18 |
. $srcdir/common |
| 19 |
. $srcdir/common-v |
| 20 |
split_std_out_err no |
| 21 |
|
| 22 |
expected=$wd/expected |
| 23 |
actual=$wd/actual |
| 24 |
ierr=$wd/i.err |
| 25 |
doubt=$wd/diff.out |
| 26 |
|
| 27 |
## |
| 28 |
# Check ident. |
| 29 |
## |
| 30 |
|
| 31 |
$hey echo ' -*- org -*-' |
| 32 |
|
| 33 |
try () |
| 34 |
{ |
| 35 |
# $1 -- FILENAME in fake/b.d/FILENAME |
| 36 |
# $2 -- expected output |
| 37 |
# $3 -- (optional) error output |
| 38 |
orig=`bundled_commav b.d/$1` |
| 39 |
echo "$2" | sed '1d;s/^|//;s/|$//' > $expected |
| 40 |
|
| 41 |
$hey echo "* $orig" |
| 42 |
must 'cp -f $orig $w' |
| 43 |
ident $w 1> $actual 2> $ierr |
| 44 |
diff -u $expected $actual > $doubt |
| 45 |
noiselessness_rules $doubt "$orig" |
| 46 |
if test "$3" ; then |
| 47 |
echo "$3" | sed '1d;s/^|//;s/|$//' > $expected |
| 48 |
diff -u $expected $ierr > $doubt |
| 49 |
noiselessness_rules $doubt "(stderr) $orig" |
| 50 |
else |
| 51 |
noiselessness_rules $ierr "(stderr) $orig" |
| 52 |
fi |
| 53 |
} |
| 54 |
|
| 55 |
## |
| 56 |
# * Without any keywords. |
| 57 |
## |
| 58 |
|
| 59 |
try 11.cou ' |
| 60 |
|t390.d/x:|' ' |
| 61 |
|ident warning: no id keywords in t390.d/x|' |
| 62 |
|
| 63 |
## |
| 64 |
# * With keywords. |
| 65 |
## |
| 66 |
|
| 67 |
try 15.col ' |
| 68 |
|t390.d/x:| |
| 69 |
| $Author: ttn $| |
| 70 |
| $Date: 2010/03/30 09:46:50 $| |
| 71 |
| $Header: /home/ttn/build/GNU/rcs/tests/fake/b,v 1.5 2010/03/30 09:46:50 ttn Exp ttn $| |
| 72 |
| $Id: b,v 1.5 2010/03/30 09:46:50 ttn Exp ttn $| |
| 73 |
| $Locker: ttn $| |
| 74 |
| $Name: $| |
| 75 |
| $RCSfile: b,v $| |
| 76 |
| $Revision: 1.5 $| |
| 77 |
| $Source: /home/ttn/build/GNU/rcs/tests/fake/b,v $| |
| 78 |
| $State: Exp $| |
| 79 |
| $Log: b,v $|' |
| 80 |
|
| 81 |
try 15.cou ' |
| 82 |
|t390.d/x:| |
| 83 |
| $Author: ttn $| |
| 84 |
| $Date: 2010/03/30 09:46:50 $| |
| 85 |
| $Header: /home/ttn/build/GNU/rcs/tests/fake/b,v 1.5 2010/03/30 09:46:50 ttn Exp $| |
| 86 |
| $Id: b,v 1.5 2010/03/30 09:46:50 ttn Exp $| |
| 87 |
| $Locker: $| |
| 88 |
| $Name: $| |
| 89 |
| $RCSfile: b,v $| |
| 90 |
| $Revision: 1.5 $| |
| 91 |
| $Source: /home/ttn/build/GNU/rcs/tests/fake/b,v $| |
| 92 |
| $State: Exp $| |
| 93 |
| $Log: b,v $|' |
| 94 |
|
| 95 |
try WOW.cou ' |
| 96 |
|t390.d/x:| |
| 97 |
| $Author: ttn $| |
| 98 |
| $Date: 2010/03/18 06:21:03 $| |
| 99 |
| $Header: /home/ttn/build/GNU/rcs/tests/fake/b,v 1.1.1.5 2010/03/18 06:21:03 ttn Exp $| |
| 100 |
| $Id: b,v 1.1.1.5 2010/03/18 06:21:03 ttn Exp $| |
| 101 |
| $Locker: $| |
| 102 |
| $Log: b,v $| |
| 103 |
| $Name: WOW $| |
| 104 |
| $RCSfile: b,v $| |
| 105 |
| $Revision: 1.1.1.5 $| |
| 106 |
| $Source: /home/ttn/build/GNU/rcs/tests/fake/b,v $| |
| 107 |
| $State: Exp $|' |
| 108 |
|
| 109 |
## |
| 110 |
# * Misc. command-line handling. |
| 111 |
## |
| 112 |
|
| 113 |
$hey echo '* misc. command-line handling' |
| 114 |
|
| 115 |
iout=$wd/i.out |
| 116 |
ierr=$wd/i.err |
| 117 |
|
| 118 |
cmd='ident -q </dev/null' |
| 119 |
$hey echo "*** $cmd" |
| 120 |
eval $cmd 1>$iout 2>$ierr |
| 121 |
noiselessness_rules $iout "$cmd" |
| 122 |
noiselessness_rules $ierr "$cmd" |
| 123 |
|
| 124 |
flail () |
| 125 |
{ |
| 126 |
# $@ -- command-line args to ident(1) |
| 127 |
cmd="ident ""$@" |
| 128 |
$hey echo "*** $cmd" |
| 129 |
eval $cmd 1>$iout 2>$ierr \ |
| 130 |
&& problem "‘$cmd’ did not fail" |
| 131 |
noiselessness_rules $iout "$cmd" |
| 132 |
silence_means_death $ierr "$cmd" |
| 133 |
$hey sed 's/^/ E:/' $ierr |
| 134 |
} |
| 135 |
|
| 136 |
flail -Z |
| 137 |
flail -q no-such-file |
| 138 |
flail no-such-file |
| 139 |
|
| 140 |
if version_at_least 5.9.0 ; then |
| 141 |
flail -V42 |
| 142 |
must 'ident -V' |
| 143 |
fi |
| 144 |
|
| 145 |
exit 0 |
| 146 |
|
| 147 |
# t390 ends here |