From e40441f901ac51988a28885412b003cf83fbd583 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Fri, 7 Feb 2020 20:53:20 +0100 Subject: [PATCH] Port history tests to littlecheck --- tests/checks/history.fish | 61 +++++++++++++++++++++++++++++++++++++++ tests/history.err | 23 --------------- tests/history.in | 44 ---------------------------- tests/history.out | 0 4 files changed, 61 insertions(+), 67 deletions(-) create mode 100644 tests/checks/history.fish delete mode 100644 tests/history.err delete mode 100644 tests/history.in delete mode 100644 tests/history.out diff --git a/tests/checks/history.fish b/tests/checks/history.fish new file mode 100644 index 000000000..f05319bde --- /dev/null +++ b/tests/checks/history.fish @@ -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 diff --git a/tests/history.err b/tests/history.err deleted file mode 100644 index b5bc875eb..000000000 --- a/tests/history.err +++ /dev/null @@ -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 diff --git a/tests/history.in b/tests/history.in deleted file mode 100644 index c3553904c..000000000 --- a/tests/history.in +++ /dev/null @@ -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 diff --git a/tests/history.out b/tests/history.out deleted file mode 100644 index e69de29bb..000000000