fish-shell/tests/checks/count.fish
Johannes Altmanninger 8bf8b10f68 Extended & human-friendly keys
See the changelog additions for user-visible changes.

Since we enable/disable terminal protocols whenever we pass terminal ownership,
tests can no longer run in parallel on the same terminal.

For the same reason, readline shortcuts in the gdb REPL will not work anymore.
As a remedy, use gdbserver, or lobby for CSI u support in libreadline.

Add sleep to some tests, otherwise they fall (both in CI and locally).

There are two weird failures on FreeBSD remaining, disable them for now
https://github.com/fish-shell/fish-shell/pull/10359/checks?check_run_id=23330096362

Design and implementation borrows heavily from Kakoune.

In future, we should try to implement more of the kitty progressive
enhancements.

Closes #10359
2024-04-02 14:35:16 +02:00

50 lines
743 B
Fish

#RUN: %fish %s | %filter-ctrlseqs
# Validate the behavior of the `count` command.
# no args
count
# CHECK: 0
# one args
count x
# CHECK: 1
# two args
count x y
# CHECK: 2
# args that look like flags or are otherwise special
count -h
# CHECK: 1
count --help
# CHECK: 1
count --
# CHECK: 1
count -- abc
# CHECK: 2
count def -- abc
# CHECK: 3
# big counts
# See #5611
for i in seq 500
set c1 (count (seq 1 10000))
test $c1 -eq 10000
or begin
echo "Count $c1 is not 10000"
break
end
end
# stdin
# Reading from stdin still counts the arguments
printf '%s\n' 1 2 3 4 5 | count 6 7 8 9 10
# CHECK: 10
# Reading from stdin counts newlines - like `wc -l`.
echo -n 0 | count
# CHECK: 0
echo 1 | count
# CHECK: 1