mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-05 08:11:15 -03:00
tests/checks/check-completions: fix for embed-data builds
This commit is contained in:
16
share/functions/__fish_list_files.fish
Normal file
16
share/functions/__fish_list_files.fish
Normal 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
|
||||
10
share/functions/__fish_with_file.fish
Normal file
10
share/functions/__fish_with_file.fish
Normal 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
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user