Port history tests to littlecheck

This commit is contained in:
Fabian Homborg 2020-02-07 20:53:20 +01:00
parent 15d2797ec1
commit e40441f901
4 changed files with 61 additions and 67 deletions

61
tests/checks/history.fish Normal file
View file

@ -0,0 +1,61 @@
#RUN: %fish %s
# Verify that specifying unexpected options or arguments results in an error.
# First using the legacy, now deprecated, long options to specify a
# subcommand.
# First with the history function.
history --search --merge
#CHECKERR: history: Mutually exclusive flags 'merge' and `search` seen
history --clear --contains
#CHECKERR: history: you cannot use any options with the clear command
history --merge -t
#CHECKERR: history: you cannot use any options with the merge command
history --save xyz
#CHECKERR: history: save expected 0 args, got 1
# Now with the history builtin.
builtin history --save --prefix
#CHECKERR: history: you cannot use any options with the save command
builtin history --clear --show-time
#CHECKERR: history: you cannot use any options with the clear command
builtin history --merge xyz
#CHECKERR: history merge: Expected 0 args, got 1
builtin history --clear abc def
#CHECKERR: history clear: Expected 0 args, got 2
# Now using the preferred subcommand form. Note that we support flags before
# or after the subcommand name so test both variants.
# First with the history function.
history clear --contains
#CHECKERR: history: you cannot use any options with the clear command
history merge -t
#CHECKERR: history: you cannot use any options with the merge command
history save xyz
#CHECKERR: history: save expected 0 args, got 1
history --prefix clear
#CHECKERR: history: you cannot use any options with the clear command
history --show-time merge
#CHECKERR: history: you cannot use any options with the merge command
# Now with the history builtin.
builtin history --search --merge
#CHECKERR: history: Invalid combination of options,
#CHECKERR: you cannot do both 'search' and 'merge' in the same invocation
builtin history save --prefix
#CHECKERR: history: you cannot use any options with the save command
builtin history clear --show-time
#CHECKERR: history: you cannot use any options with the clear command
builtin history merge xyz
#CHECKERR: history merge: Expected 0 args, got 1
builtin history clear abc def
#CHECKERR: history clear: Expected 0 args, got 2
builtin history --contains save
#CHECKERR: history: you cannot use any options with the save command
builtin history -t merge
#CHECKERR: history: you cannot use any options with the merge command
# Now do a history command that should succeed so we exit with a zero,
# success, status.
builtin history save

View file

@ -1,23 +0,0 @@
history: Mutually exclusive flags 'merge' and `search` seen
history: you cannot use any options with the clear command
history: you cannot use any options with the merge command
history: save expected 0 args, got 1
history: you cannot use any options with the save command
history: you cannot use any options with the clear command
history merge: Expected 0 args, got 1
history clear: Expected 0 args, got 2
history: you cannot use any options with the clear command
history: you cannot use any options with the merge command
history: save expected 0 args, got 1
history: you cannot use any options with the clear command
history: you cannot use any options with the merge command
history: Invalid combination of options,
you cannot do both 'search' and 'merge' in the same invocation
history: you cannot use any options with the save command
history: you cannot use any options with the clear command
history merge: Expected 0 args, got 1
history clear: Expected 0 args, got 2
history: you cannot use any options with the save command
history: you cannot use any options with the merge command

View file

@ -1,44 +0,0 @@
# Verify that specifying unexpected options or arguments results in an error.
# First using the legacy, now deprecated, long options to specify a
# subcommand.
# First with the history function.
history --search --merge
history --clear --contains
history --merge -t
history --save xyz
# Now with the history builtin.
builtin history --save --prefix
builtin history --clear --show-time
builtin history --merge xyz
builtin history --clear abc def
# Put a blank line in the stderr output to separate the above sequence from
# the following sequence of tests.
echo >&2
# Now using the preferred subcommand form. Note that we support flags before
# or after the subcommand name so test both variants.
# First with the history function.
history clear --contains
history merge -t
history save xyz
history --prefix clear
history --show-time merge
echo >&2
# Now with the history builtin.
builtin history --search --merge
builtin history save --prefix
builtin history clear --show-time
builtin history merge xyz
builtin history clear abc def
builtin history --contains save
builtin history -t merge
# Now do a history command that should succeed so we exit with a zero,
# success, status.
builtin history save

View file