| 1 |
# t301 --- rlog on RCS file w/ bad ‘integrity’ |
| 2 |
# |
| 3 |
# Copyright (C) 2013-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 |
## |
| 19 |
# We expect rlog to barf on an RCS file w/ bad ‘integrity’. |
| 20 |
# |
| 21 |
# This test checks that rlog exits failurefully, but DOES NOT |
| 22 |
# check the error message. |
| 23 |
# |
| 24 |
# TODO: Validate error message. |
| 25 |
## |
| 26 |
|
| 27 |
. $srcdir/common |
| 28 |
split_std_out_err no |
| 29 |
|
| 30 |
echo ' -*-org-*-' |
| 31 |
echo '* rlog:' `which rlog` |
| 32 |
|
| 33 |
barf () |
| 34 |
{ |
| 35 |
# $1 -- title, in the form of ADJECTIVE-PHRASE |
| 36 |
# $2 -- shell command to create $v |
| 37 |
blurb="on invalid ($1) RCS file" |
| 38 |
echo "* (barf) $1" |
| 39 |
must "$2" |
| 40 |
$hey echo "** $v" |
| 41 |
$hey sed 's/^/|/' $v |
| 42 |
$hey echo "** invocation" |
| 43 |
rlog $v |
| 44 |
res=$? |
| 45 |
test 0 = $res && problem "rlog did not barf $blurb" |
| 46 |
test 1 = $res || problem "bad rlog exit value ($res) $blurb" |
| 47 |
} |
| 48 |
|
| 49 |
src=`bundled_commav empty` |
| 50 |
|
| 51 |
barf "non-string value" \ |
| 52 |
'sed "/^comment/s/^/integrity 42;/" $src > $v' |
| 53 |
|
| 54 |
barf "spurious '@' (U+40)" \ |
| 55 |
'sed "/^comment/s/^/integrity @@@@;/" $src > $v' |
| 56 |
|
| 57 |
barf "two spurious '@' (U+40)" \ |
| 58 |
'sed "/^comment/s/^/integrity @@@@@@;/" $src > $v' |
| 59 |
|
| 60 |
exit 0 |
| 61 |
|
| 62 |
# t301 ends here |