mirror of
https://github.com/go-task/task.git
synced 2026-07-09 20:09:14 +02:00
chore(completion): trim redundant comments in tests and wrappers
This commit is contained in:
@@ -48,9 +48,8 @@ function __task_complete --inherit-variable GO_TASK_PROGNAME
|
||||
# native file fallback. Every file-completion directive must therefore be
|
||||
# served here, otherwise nothing is offered (e.g. `--cacert`, after `--`).
|
||||
|
||||
# FilterFileExt: the engine emits the allowed extensions as the data lines.
|
||||
# __fish_complete_suffix only *prioritizes* the extension, so filter the file
|
||||
# list ourselves — keeping directories so the user can still descend into them.
|
||||
# __fish_complete_suffix only *prioritizes* the extension rather than
|
||||
# filtering, so filter the file list ourselves (keeping dirs to descend into).
|
||||
if __task_test_bit $directive $__task_directive_filter_file_ext
|
||||
for entry in (__fish_complete_path $current)
|
||||
set -l name (string split -f1 \t -- $entry)
|
||||
@@ -68,14 +67,13 @@ function __task_complete --inherit-variable GO_TASK_PROGNAME
|
||||
return
|
||||
end
|
||||
|
||||
# FilterDirs: complete directories only.
|
||||
if __task_test_bit $directive $__task_directive_filter_dirs
|
||||
__fish_complete_directories $current
|
||||
return
|
||||
end
|
||||
|
||||
# Emit the `value\tdescription` candidates (fish reads the tab as the
|
||||
# separator between the completion and its description).
|
||||
# Emit the candidates verbatim; fish reads the tab as the value/description
|
||||
# separator.
|
||||
for line in $data
|
||||
printf '%s\n' $line
|
||||
end
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
// Package completion_test black-box tests the `task __complete` wire protocol —
|
||||
// the candidates and directive the engine emits for a given command line. This
|
||||
// replaces the old completion/tests/engine.sh with readable, table-driven Go:
|
||||
// the shell wrappers only need to be smoke-tested for how they *interpret* the
|
||||
// directive (see completion/tests/wrapper.*), never for the suggestion logic,
|
||||
// which is fully covered here and in internal/complete.
|
||||
// Package completion_test black-box tests the `task __complete` wire protocol:
|
||||
// the candidates and directive the real binary emits for a command line. The
|
||||
// shell wrappers only need to be smoke-tested for how they interpret the
|
||||
// directive (see completion/tests/wrapper.*).
|
||||
package completion_test
|
||||
|
||||
import (
|
||||
@@ -21,7 +19,6 @@ import (
|
||||
"github.com/go-task/task/v3/internal/complete"
|
||||
)
|
||||
|
||||
// taskBin is the path to the task binary built once for the whole package.
|
||||
var taskBin string
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
# Smoke-tests how the bash wrapper INTERPRETS each directive by stubbing the
|
||||
# bash-completion helpers it calls (_filedir / compopt / __ltrim_colon_completions)
|
||||
# and asserting the routing. The suggestion logic (which tasks/aliases/vars) is
|
||||
# covered by the Go tests; here we only check that each directive triggers the
|
||||
# right shell behavior. Deterministic, no TTY, works without bash-completion.
|
||||
#
|
||||
# Requires: TASK_BIN (task binary), TASK_FIXTURE (dir with a Taskfile.yml).
|
||||
# Smoke-tests how the bash wrapper routes each directive by stubbing the
|
||||
# bash-completion helpers (_filedir / compopt / …) and asserting what it calls.
|
||||
# Suggestion logic lives in the Go tests. Requires TASK_BIN and TASK_FIXTURE.
|
||||
set -u
|
||||
|
||||
: "${TASK_BIN:?}"; : "${TASK_FIXTURE:?}"
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
#!/usr/bin/env fish
|
||||
# Smoke-tests how the fish wrapper INTERPRETS each directive (files vs dirs vs
|
||||
# no files) via `complete -C`, which asks fish for the real completions without
|
||||
# a TTY. The suggestion logic (which tasks/aliases/vars) is covered by the Go
|
||||
# tests; here we only check routing. `task` must resolve to the binary under
|
||||
# test (run.sh puts a symlink on PATH).
|
||||
#
|
||||
# Requires: TASK_FIXTURE (dir with a Taskfile.yml and sample files/dirs).
|
||||
# Smoke-tests how the fish wrapper routes each directive, via `complete -C`
|
||||
# (real completions, no TTY). Suggestion logic lives in the Go tests.
|
||||
# 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
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
# Smoke-tests how the PowerShell wrapper INTERPRETS each directive (files vs
|
||||
# dirs vs no files) plus its own prefix filtering, via the completion API which
|
||||
# returns real completions without a TTY. The suggestion logic (which
|
||||
# tasks/aliases/vars) is covered by the Go tests; here we only check routing.
|
||||
# `task` must resolve to the binary under test (run.sh puts a symlink on PATH).
|
||||
#
|
||||
# Requires: $env:TASK_FIXTURE (dir with a Taskfile.yml and sample files/dirs).
|
||||
# Smoke-tests how the PowerShell wrapper routes each directive (plus its own
|
||||
# prefix filtering), via the completion API (real completions, no TTY).
|
||||
# Suggestion logic lives in the Go tests. Set up by run.sh: $env:TASK_FIXTURE,
|
||||
# and `task` on PATH = the binary under test.
|
||||
|
||||
Set-Location $env:TASK_FIXTURE
|
||||
. "$PSScriptRoot/../ps/task.ps1"
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
#!/usr/bin/env zsh
|
||||
# Smoke-tests how the zsh wrapper INTERPRETS each directive by stubbing the
|
||||
# completion-system functions it calls (_describe / _files / _path_files) and
|
||||
# asserting the routing. The suggestion logic (which tasks/aliases/vars) is
|
||||
# covered by the Go tests; here we only check that each directive triggers the
|
||||
# right shell behavior. Deterministic, no TTY.
|
||||
#
|
||||
# Requires: TASK_BIN (task binary), TASK_FIXTURE (dir with a Taskfile.yml).
|
||||
# Smoke-tests how the zsh wrapper routes each directive by stubbing the
|
||||
# completion functions (_describe / _files / _path_files) and asserting what it
|
||||
# calls. Suggestion logic lives in the Go tests. Requires TASK_BIN, TASK_FIXTURE.
|
||||
|
||||
export TASK_EXE=$TASK_BIN
|
||||
cd $TASK_FIXTURE
|
||||
|
||||
Reference in New Issue
Block a user