From 74e60036f1f0495132033532b87258554f2694d9 Mon Sep 17 00:00:00 2001 From: Bruno Pinto Date: Thu, 19 Feb 2015 01:46:30 -0200 Subject: [PATCH 1/2] import tests --- spec/import.spec.fish | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 spec/import.spec.fish diff --git a/spec/import.spec.fish b/spec/import.spec.fish new file mode 100644 index 0000000..12eb119 --- /dev/null +++ b/spec/import.spec.fish @@ -0,0 +1,42 @@ +import plugins/fish-spec + +function describe_import + function before_all + set -g fish_function_path_bak $fish_function_path + + list.erase "$fish_path/plugins/archlinux" --from fish_function_path + list.erase "$fish_path/plugins/git-flow" --from fish_function_path + list.erase "$fish_path/plugins/tiny" --from fish_function_path + end + + function after_all + set fish_function_path $fish_function_path_bak + end + + function it_imports_all_fish_files + import plugins/tiny + expect $fish_function_path --to-contain-all $fish_path/plugins/tiny + end + + function it_imports_all_fish_files_recursively + import plugins/archlinux + expect $fish_function_path --to-contain-all $fish_path/plugins/archlinux/pacman + end + + function it_does_not_import_test_files + import plugins/tiny + expect $fish_function_path --to-not-contain-all $fish_path/plugins/spec + end + + function it_does_not_import_completion_files + import plugins/git-flow + expect $fish_function_path --to-not-contain-all $fish_path/plugins/git-flow/completions/ + end + + function it_adds_completion_files_to_completion_path + import plugins/git-flow + expect $fish_complete_path --to-contain-all $fish_path/plugins/git-flow/completions + end +end + +spec.run $argv From b0354ce36fde6fb3f70ef5b7da02182cf4be6aa5 Mon Sep 17 00:00:00 2001 From: Bruno Pinto Date: Thu, 19 Feb 2015 02:22:57 -0200 Subject: [PATCH 2/2] do not traverse completions directory --- functions/_prepend_tree.fish | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/functions/_prepend_tree.fish b/functions/_prepend_tree.fish index fc6d177..4b2213d 100644 --- a/functions/_prepend_tree.fish +++ b/functions/_prepend_tree.fish @@ -84,13 +84,9 @@ function _prepend_tree -d "Add a dependency tree to the Fish path." end end - # Null wildcard expansion will break the for loop even if $path is valid. - # $subs will become an empty list for directories without sub directories - # which is safe to use in the loop. - set -l subs $path/**/ - - # Traverse $path and $subs prepending only directories with matches. - for dir in $path $subs + # Traverse $path prepending only directories with matches. Excludes completions folder. + test -d $path + and for dir in (find $path \! -name "completions" -type d) # Use head to retrieve at least one match. Skip not found errors # for directories that do not exist. if [ -z (find "$dir" $glob -maxdepth 1 ^/dev/null | head -1) ]