fork/fish-shell

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

Nahortests: various fixes for Cygwin itself and ACL mounts944ab91fa

master
2.4 KiB78 linesraw
1#RUN: fish=%fish %fish %s
2
3# REQUIRES: %fish -c "__fish_is_cygwin"
4
5mkdir dir
6echo "#!/bin/sh" >dir/foo.exe
7echo "#!/bin/sh" >dir/foo.bar
8if ! cygwin_noacl ./
9    chmod u+x dir/foo*
10end
11set -p PATH (pwd)/dir
12
13# === Check that `complete` prefers to non-exe name, unless the user started
14# to type the extension
15complete -C"./dir/fo"
16# CHECK: ./dir/foo{{\t}}command
17# CHECK: ./dir/foo.bar{{\t}}command
18complete -C"./dir/foo."
19# CHECK: ./dir/foo.bar{{\t}}command
20# CHECK: ./dir/foo.exe{{\t}}command
21
22# === Check that foo.exe uses foo's description if it doesn't have its own
23function __fish_describe_command
24    echo -e "foo\tposix"
25end
26complete -C"./dir/foo."
27# CHECK: ./dir/foo.bar{{\t}}command
28# CHECK: ./dir/foo.exe{{\t}}Posix
29function __fish_describe_command
30    echo -e "foo\tposix"
31    echo -e "foo.exe\twindows"
32end
33complete -C"./dir/fo"
34# CHECK: ./dir/foo{{\t}}Posix
35# CHECK: ./dir/foo.bar{{\t}}command
36complete -C"./dir/foo."
37# CHECK: ./dir/foo.bar{{\t}}command
38# CHECK: ./dir/foo.exe{{\t}}Windows
39
40# === Check that if we have a non-exe and an exe file, they both show
41echo "#!/bin/sh" >dir/foo.bar.exe
42if ! cygwin_noacl ./
43    chmod u+x dir/foo.bar.exe
44end
45complete -C"./dir/foo.ba"
46# CHECK: ./dir/foo.bar{{\t}}command
47# CHECK: ./dir/foo.bar.exe{{\t}}command
48
49# === Check that "foo.fish" completion file is used when completing "foo.exe"
50# and there is no "foo.exe.fish"
51mkdir $__fish_config_dir/completions
52echo "complete -c foo -s a -d args; complete -c foo -s b -d bargs" >$__fish_config_dir/completions/foo.fish
53complete -C"./dir/foo.exe -"
54# CHECK: -a{{\t}}args
55# CHECK: -b{{\t}}bargs
56
57# === Check that "foo.exe.fish" is used over "foo.fish" when both are present
58# when completing "foo.exe" (but still uses "foo.fish" for "foo")
59# Note: use subshell to avoid waiting 15s for the autoload cache to become stale
60echo "complete -c foo -s c -d cargs; complete -c foo -s d -d dargs" >$__fish_config_dir/completions/foo.exe.fish
61$fish -ic 'complete -C"./dir/foo.exe -"'
62# CHECK: -c{{\t}}cargs
63# CHECK: -d{{\t}}dargs
64$fish -ic 'complete -C"./dir/foo -"'
65# CHECK: -a{{\t}}args
66# CHECK: -b{{\t}}bargs
67
68# === We only support exe=>non-exe fallback for description/args completion.
69# We do not handle the other way around
70function __fish_describe_command
71    echo -e "foo.bar.exe\twindows"
72end
73rm $__fish_config_dir/completions/foo.fish
74complete -C"./dir/foo.ba"
75# CHECK: ./dir/foo.bar{{\t}}command
76# CHECK: ./dir/foo.bar.exe{{\t}}Windows
77$fish -ic 'complete -C"./dir/foo -"'
78# nothing