# t181 --- merge(1) w/ invalid options, arguments
#
# Copyright (C) 2016-2022 Thien-Thi Nguyen
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

. $srcdir/common
. $srcdir/common-v
split_std_out_err
$hey set -x

##
# Check that various invalid command-lines do indeed fail.
##

flail ()
{
    # $@ -- command-line args to merge(1)
    merge "$@" \
        && problem '‘merge '"$@"'’ did not fail'
}

flail -A -E
flail -E -A
flail -A -e
flail -e -A
flail -E -e
flail -e -E

flail -L
flail -L A -L B -L C -L D

flail -pqr

flail 1 2 3 4

##
# For RCS 5.9.0 and later, check behavior of
# ‘merge -V’ and ‘merge -VN’.
##

if version_at_least 5.9.0 ; then
    flail -V5
    must 'merge -V'
fi

exit 0

# t181 ends here
