Commit 75ba7639 authored by Bruno Pinto's avatar Bruno Pinto

+bucaran array.delete

parent 7c9d660f
# Remove item from list. List must be the name of a global variable.
# @params <item> <list>
function array.delete
set -l item $argv[1]
if set -l index (contains -i -- $item $$argv[2])
set -e $argv[2][$index]
end
end
set -l fish_tank /usr/local/share/fish-tank/tank.fish
if not test -e $fish_tank
echo 'error: fish-tank is required to run these tests (https://github.com/terlar/fish-tank)'
exit 1
end
source $fish_tank
......@@ -32,13 +32,16 @@ function describe_oh_my_fish
end
function it_loads_all_oh_my_fish_functions
remove_from_array "$fish_path/functions/" fish_function_path
array.delete "$fish_path/functions/" fish_function_path
load_oh_my_fish
expect $fish_function_path to_include $fish_path/functions/
end
function it_loads_all_selected_plugins
remove_from_array "$fish_path/plugins/z" fish_function_path
array.delete "$fish_path/plugins/bak" fish_function_path
array.delete "$fish_path/plugins/z" fish_function_path
set fish_plugins bak z
load_oh_my_fish
expect $fish_function_path to_include $fish_path/plugins/bak and
......@@ -46,7 +49,8 @@ function describe_oh_my_fish
end
function it_loads_the_selected_theme
remove_from_array "$fish_path/themes/l" fish_function_path
array.delete "$fish_path/themes/l" fish_function_path
set fish_theme l
load_oh_my_fish
expect $fish_function_path to_include $fish_path/themes/l
......@@ -57,15 +61,4 @@ function load_oh_my_fish
. $fish_path/oh-my-fish.fish
end
function remove_from_array
set -l element $argv[1]
for i in (seq (count $$argv[2]))
if test $$argv[2][$i] = $element
set -e $argv[2][$i]
break
end
end
end
import plugins/fish-spec
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment