refactor(completion): move the shell test harness out of completion/

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.
This commit is contained in:
Valentin Maerten
2026-08-29 11:05:08 +02:00
parent b782d18a45
commit a9bf2c8020
8 changed files with 8 additions and 12 deletions

View File

@@ -43,12 +43,7 @@ archives:
files:
- README.md
- LICENSE
- completion/bash/*
- completion/fish/*
- completion/nu/*
- completion/ps/*
- completion/zsh/*
- completion/legacy/**/*
- completion/**/*
format_overrides:
- goos: windows
formats: [zip]

View File

@@ -164,8 +164,9 @@ tasks:
- internal/complete/**/*.go
- cmd/task/**/*.go
- completion/**/*
- testdata/completion/*
cmds:
- bash completion/tests/run.sh
- bash testdata/completion/run.sh
goreleaser:test:
desc: Tests release process without publishing

View File

@@ -22,7 +22,7 @@ _filedir() { CAP+="filedir:$* cur=$cur"$'\n'; }
compopt() { CAP+="compopt:$*"$'\n'; }
__ltrim_colon_completions() { :; }
source "$(dirname "${BASH_SOURCE[0]}")/../bash/task.bash"
source "$(dirname "${BASH_SOURCE[0]}")/../../completion/bash/task.bash"
run() {
CAP=""

View File

@@ -3,7 +3,7 @@
# Set up by run.sh: TASK_FIXTURE, and `task` on PATH = the binary under test.
cd $TASK_FIXTURE
source (dirname (status -f))/../fish/task.fish
source (dirname (status -f))/../../completion/fish/task.fish
set -g fails 0

View File

@@ -4,7 +4,7 @@
# Set up by run.sh: $env.TASK_FIXTURE, and `task` on PATH = the binary under test.
# `source` needs a parse-time constant path.
const TASK_NU = (path self "../nu/task-completions.nu")
const TASK_NU = (path self "../../completion/nu/task-completions.nu")
# Installed before the wrapper is sourced, to assert the delegation path.
$env.config.completions.external.completer = {|spans| [{ value: $"prev:($spans | first)" }] }

View File

@@ -3,7 +3,7 @@
# the binary under test.
Set-Location $env:TASK_FIXTURE
. "$PSScriptRoot/../ps/task.ps1"
. "$PSScriptRoot/../../completion/ps/task.ps1"
$fails = 0

View File

@@ -29,7 +29,7 @@ _files() { CAP+="files:$*"$'\n' }
_path_files() { CAP+="path_files:$*"$'\n' }
# Sourcing avoids the autoload first-call quirk; `compdef` is stubbed above.
source ${0:A:h}/../zsh/_task
source ${0:A:h}/../../completion/zsh/_task
run() {
CAP=""