fish-shell/tests/checks/history.fish

73 lines
2.6 KiB
Fish
Raw Normal View History

#RUN: %fish %s
2020-02-07 19:53:20 +00:00
# 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
2021-11-04 05:52:17 +00:00
#CHECKERR: history: merge search: options cannot be used together
2020-02-07 19:53:20 +00:00
history --clear --contains
2021-11-04 05:52:17 +00:00
#CHECKERR: history: clear: subcommand takes no options
2020-02-07 19:53:20 +00:00
history --merge -t
2021-11-04 05:52:17 +00:00
#CHECKERR: history: merge: subcommand takes no options
2020-02-07 19:53:20 +00:00
history --save xyz
2021-11-04 05:52:17 +00:00
#CHECKERR: history: save: expected 0 arguments; got 1
2020-02-07 19:53:20 +00:00
# Now with the history builtin.
builtin history --save --prefix
2021-11-04 05:52:17 +00:00
#CHECKERR: history: save: subcommand takes no options
2020-02-07 19:53:20 +00:00
builtin history --clear --show-time
2021-11-04 05:52:17 +00:00
#CHECKERR: history: clear: subcommand takes no options
2020-02-07 19:53:20 +00:00
builtin history --merge xyz
2021-11-04 05:52:17 +00:00
#CHECKERR: history: merge: expected 0 arguments; got 1
2020-02-07 19:53:20 +00:00
builtin history --clear abc def
2021-11-04 05:52:17 +00:00
#CHECKERR: history: clear: expected 0 arguments; got 2
2020-02-07 19:53:20 +00:00
# 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
2021-11-04 05:52:17 +00:00
#CHECKERR: history: clear: subcommand takes no options
history clear-session --contains
2021-11-04 05:52:17 +00:00
#CHECKERR: history: clear-session: subcommand takes no options
2020-02-07 19:53:20 +00:00
history merge -t
2021-11-04 05:52:17 +00:00
#CHECKERR: history: merge: subcommand takes no options
2020-02-07 19:53:20 +00:00
history save xyz
2021-11-04 05:52:17 +00:00
#CHECKERR: history: save: expected 0 arguments; got 1
2020-02-07 19:53:20 +00:00
history --prefix clear
2021-11-04 05:52:17 +00:00
#CHECKERR: history: clear: subcommand takes no options
history --prefix clear-session
2021-11-04 05:52:17 +00:00
#CHECKERR: history: clear-session: subcommand takes no options
2020-02-07 19:53:20 +00:00
history --show-time merge
2021-11-04 05:52:17 +00:00
#CHECKERR: history: merge: subcommand takes no options
2020-02-07 19:53:20 +00:00
# Now with the history builtin.
builtin history --search --merge
2021-11-04 05:52:17 +00:00
#CHECKERR: history: search merge: options cannot be used together
2020-02-07 19:53:20 +00:00
builtin history save --prefix
2021-11-04 05:52:17 +00:00
#CHECKERR: history: save: subcommand takes no options
2020-02-07 19:53:20 +00:00
builtin history clear --show-time
2021-11-04 05:52:17 +00:00
#CHECKERR: history: clear: subcommand takes no options
builtin history clear-session --show-time
2021-11-04 05:52:17 +00:00
#CHECKERR: history: clear-session: subcommand takes no options
2020-02-07 19:53:20 +00:00
builtin history merge xyz
2021-11-04 05:52:17 +00:00
#CHECKERR: history: merge: expected 0 arguments; got 1
2020-02-07 19:53:20 +00:00
builtin history clear abc def
2021-11-04 05:52:17 +00:00
#CHECKERR: history: clear: expected 0 arguments; got 2
builtin history clear-session abc def
2021-11-04 05:52:17 +00:00
#CHECKERR: history: clear-session: expected 0 arguments; got 2
2020-02-07 19:53:20 +00:00
builtin history --contains save
2021-11-04 05:52:17 +00:00
#CHECKERR: history: save: subcommand takes no options
2020-02-07 19:53:20 +00:00
builtin history -t merge
2021-11-04 05:52:17 +00:00
#CHECKERR: history: merge: subcommand takes no options
2020-02-07 19:53:20 +00:00
# Now do a history command that should succeed so we exit with a zero,
# success, status.
builtin history save
set -g fish_private_mode 1
builtin history merge
#CHECKERR: history: can't merge history in private mode