fork/fish-shell

git clone https://git.julia.blue/fork/fish-shell

Johannes Altmanningertests: filter control sequences only when interactive1e858eae3

master
724 B50 linesraw
1#RUN: %fish %s
2# Validate the behavior of the `count` command.
3
4# no args
5count
6# CHECK: 0
7
8# one args
9count x
10# CHECK: 1
11
12# two args
13count x y
14# CHECK: 2
15
16# args that look like flags or are otherwise special
17count -h
18# CHECK: 1
19count --help
20# CHECK: 1
21count --
22# CHECK: 1
23count -- abc
24# CHECK: 2
25count def -- abc
26# CHECK: 3
27
28# big counts
29
30# See #5611
31for i in seq 500
32    set c1 (count (seq 1 10000))
33    test $c1 -eq 10000
34    or begin
35        echo "Count $c1 is not 10000"
36        break
37    end
38end
39
40# stdin
41# Reading from stdin still counts the arguments
42printf '%s\n' 1 2 3 4 5 | count 6 7 8 9 10
43# CHECK: 10
44
45# Reading from stdin counts newlines - like `wc -l`.
46echo -n 0 | count
47# CHECK: 0
48
49echo 1 | count
50# CHECK: 1