tests/checks/check-completions: fix for embed-data builds

This commit is contained in:
Johannes Altmanninger
2025-10-12 06:31:28 +02:00
parent 189a2e90dd
commit 6c48e214ca
3 changed files with 28 additions and 2 deletions

View File

@@ -0,0 +1,16 @@
# localization: skip(private)
function __fish_list_files
set -l dir $argv[1]
if set -q __fish_data_dir[1]
# Construct a directory prefix without trailing slash.
if test -n "$dir"
set dir $__fish_data_dir/$dir
else
set dir $__fish_data_dir
end
set -l files $dir/**
string replace -- $dir/ '' $files
else
status list-files $dir
end
end

View File

@@ -0,0 +1,10 @@
# localization: skip(private)
function __fish_with_file
set -l file $argv[1]
set -l cmd $argv[2..]
if set -q __fish_data_dir[1]
$cmd $__fish_data_dir/$file
else
status get-file $file | $cmd
end
end

View File

@@ -4,9 +4,9 @@
# Test all completions where the command exists
# No output is good output
for f in $__fish_data_dir/completions/*.fish
for f in (__fish_list_files completions | string match 'completions/*.fish')
if type -q (string replace -r '.*/([^/]+).fish' '$1' $f)
set -l out (source $f 2>&1 | string collect)
set -l out (__fish_with_file $f source 2>&1 | string collect)
test -n "$out"
and echo -- OUTPUT from $f: $out
end