fork/fish-shell

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

Johannes Altmanningertests: filter control sequences only when interactive1e858eae3

master
2.2 KiB98 linesraw
1#RUN: %fish %s
2function commandline
3    if test $argv[1] = -ct
4        echo --long4\n-4
5    else if test $argv[1] = -cpx
6        echo cmd\n-z\n-bc\n--long1\narg1\n-d\narg2\n--long2
7    end
8end
9
10__fish_contains_opt -s z
11or echo fails to find -z
12
13__fish_contains_opt -s c
14or echo fails to find -c
15
16__fish_contains_opt -s x
17and echo should not have found -x
18
19__fish_contains_opt -s x -s z
20or echo fails to find -z
21
22__fish_contains_opt -s x -s c
23or echo fails to find -c
24
25__fish_contains_opt -s x long1
26or echo fails to find --long1
27
28__fish_contains_opt long2
29or echo fails to find --long2
30
31__fish_contains_opt long1 long2
32or echo fails to find --long1 or --long2
33
34__fish_contains_opt long3
35and echo should not have found --long3
36
37__fish_contains_opt -s 4 long4
38or echo fails to find -4
39
40__fish_contains_opt long4
41and echo should not have found --long4
42
43__fish_contains_opt arg1
44and echo should not have found --arg1
45
46__fish_contains_opt -s a
47and echo should not have found -a
48
49# This should result in message written to stderr and an error status.
50__fish_contains_opt -x w
51and '"__fish_contains_opt -x w" should not have succeeded'
52#CHECKERR: __fish_contains_opt: Unknown option -x
53
54__fish_not_contain_opt -s z
55and echo should not have found -z
56
57__fish_not_contain_opt -s c
58and echo should not have found -c
59
60__fish_not_contain_opt -s x
61or echo unexpectedly found -x
62
63__fish_not_contain_opt -s x -s z
64and echo should not have found -x/-z
65
66__fish_not_contain_opt -s x -s c
67and echo should not have found -x/-c
68
69__fish_not_contain_opt -s x long1
70and echo should not have found --long1
71
72__fish_not_contain_opt long2
73and echo found --long2
74
75__fish_not_contain_opt long1 long2
76and echo found --long1 or --long2
77
78__fish_not_contain_opt long3
79or echo unexpectedly found --long3
80
81__fish_not_contain_opt -s 4 long4
82and echo unexpectedly found -4
83
84__fish_not_contain_opt long4
85or echo should not have found --long4
86
87__fish_not_contain_opt arg1
88or echo should not have found --arg1
89
90__fish_not_contain_opt -s a
91or echo should not have found -a
92
93# This should result in message written to stderr and an error status.
94__fish_not_contain_opt -x w
95and '"__fish_not_contain_opt -x w" should not have succeeded'
96#CHECKERR: __fish_not_contain_opt: Unknown option -x
97
98true