mirror of
https://github.com/go-task/task.git
synced 2026-09-01 19:50:16 +02:00
Packaging globs completion/ into the release archives, so the harness added alongside the engine was about to ship run.sh and five wrapper scripts to every user. The previous commit worked around it by listing the packaged directories one by one, which quietly stops packaging any shell added later. Moving the harness to testdata/completion/ leaves completion/ holding only what we ship, so the glob can go back to completion/**/* and needs no maintenance when a shell is added.
56 lines
1.7 KiB
Fish
Executable File
56 lines
1.7 KiB
Fish
Executable File
#!/usr/bin/env fish
|
|
# Smoke-tests how the fish wrapper routes each directive, via `complete -C`.
|
|
# Set up by run.sh: TASK_FIXTURE, and `task` on PATH = the binary under test.
|
|
|
|
cd $TASK_FIXTURE
|
|
source (dirname (status -f))/../../completion/fish/task.fish
|
|
|
|
set -g fails 0
|
|
|
|
function cands
|
|
complete -C $argv[1] | string split -f1 \t
|
|
end
|
|
|
|
function has # LABEL LINE VALUE
|
|
if contains -- $argv[3] (cands $argv[2])
|
|
echo " ok $argv[1]"
|
|
else
|
|
echo " FAIL $argv[1] — '$argv[3]' missing from: "(cands $argv[2])
|
|
set fails (math $fails + 1)
|
|
end
|
|
end
|
|
|
|
function hasnot # LABEL LINE VALUE
|
|
if contains -- $argv[3] (cands $argv[2])
|
|
echo " FAIL $argv[1] — '$argv[3]' should be absent"
|
|
set fails (math $fails + 1)
|
|
else
|
|
echo " ok $argv[1]"
|
|
end
|
|
end
|
|
|
|
echo "fish: :4 (NoFileComp) forwards candidates, offers no files"
|
|
has "candidate forwarded" 'task ' build
|
|
hasnot "no file fallback" 'task ' notes.txt
|
|
|
|
echo "fish: :16 (FilterDirs) offers directories only"
|
|
has "dir offered" 'task --dir ' sub/
|
|
hasnot "no plain file" 'task --dir ' notes.txt
|
|
|
|
echo "fish: :8 (FilterFileExt) filters by extension"
|
|
has "matching file" 'task --taskfile ' Taskfile.yml
|
|
hasnot "non-matching file" 'task --taskfile ' notes.txt
|
|
|
|
echo "fish: :0 (Default) falls back to files"
|
|
has "file offered" 'task build -- ' notes.txt
|
|
|
|
echo "fish: inline --flag=path keeps the --flag= prefix"
|
|
has "inline nested" 'task --taskfile=sub/' --taskfile=sub/nested.yml
|
|
hasnot "inline non-matching" 'task --taskfile=' --taskfile=notes.txt
|
|
|
|
if test $fails -ne 0
|
|
echo "fish: $fails failure(s)"
|
|
exit 1
|
|
end
|
|
echo "fish: all passed"
|