Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
O
oh-my-fish
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
oh-my-fish
Commits
fed8c863
You need to sign in or sign up before continuing.
Commit
fed8c863
authored
Jan 10, 2015
by
Bruno Pinto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #298 from bucaran/master
parents
f34f1140
64ea3d80
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
97 additions
and
13 deletions
+97
-13
plugins/fish-spec/array.delete.fish
plugins/fish-spec/array.delete.fish
+0
-8
plugins/fish-spec/expect.fish
plugins/fish-spec/expect.fish
+10
-0
plugins/fish-spec/list.erase.fish
plugins/fish-spec/list.erase.fish
+35
-0
plugins/fish-spec/test/list.erase.test.fish
plugins/fish-spec/test/list.erase.test.fish
+48
-0
test/oh_my_fish.test.fish
test/oh_my_fish.test.fish
+4
-5
No files found.
plugins/fish-spec/array.delete.fish
deleted
100644 → 0
View file @
f34f1140
# 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
plugins/fish-spec/expect.fish
View file @
fed8c863
...
...
@@ -20,5 +20,15 @@ function expect
else
emit assertion_failure "Expected \"$list\" to include \"$item\""
end
case 'to_not_include'
set -l item $actual
set -l list $expected
if not contains -- "$item" $list
emit assertion_success
else
emit assertion_failure "Expected \"$list\" to not include \"$item\""
end
end
end
plugins/fish-spec/list.erase.fish
0 → 100644
View file @
fed8c863
# NAME
# list.erase - erase items from lists
#
# SYNOPSIS
# <item> [<item>...] [--from] <list>
# <item> [<item>...] --from <list1> [<list2>...]
#
# DESCRIPTION
# Erase any number of items from any number of lists. If more than one
# list is specified it must be separated from the items with --from.
#
# NOTES
# While items are basically any valid sequence of symbols, lists refer
# to any global variable or local variable in the scope of the calling
# function by name.
#
#/
function -S list.erase
# List to erase from is last item by default.
set -l items $argv[1..-2]
set -l lists $argv[-1]
if set -l index (contains -i -- --from $argv)
# Everything before --from are items to erase and everything
# after, lists to erase any found items from.
set items $argv[1..(math $index-1)]
set lists $argv[(math $index+1)..-1]
end
for item in $items
for list in $lists
if set -l index (contains -i -- $item $$list)
set -e $list[1][$index]
end
end
end
end
plugins/fish-spec/test/list.erase.test.fish
0 → 100644
View file @
fed8c863
function describe_list_erase
function before_each
set -g nums_until_10 1 2 3 4 5 6 7 8 9 10
set -g odds_until_10 1 3 5 7 9
end
function it_erases_one_element
list.erase 1 nums_until_10
expect $nums_until_10 to_not_include 1
end
function it_erases_one_element_with_from_syntax
list.erase 1 --from nums_until_10
expect $nums_until_10 to_not_include 1
end
function it_erases_one_element_from_multiple_lists
list.erase 1 --from nums_until_10 odds_until_10
expect $nums_until_10 to_not_include 1 and
expect $odds_until_10 to_not_include 1
end
function it_erases_one_element_from_multiple_lists_when_only_one_has_the_element
list.erase 2 --from nums_until_10 odds_until_10
expect $nums_until_10 to_not_include 2
end
function it_erases_multiple_elements
list.erase 1 2 nums_until_10
expect $nums_until_10 to_not_include 1 and
expect $nums_until_10 to_not_include 2
end
function it_erases_multiple_elements_with_from_syntax
list.erase 1 2 --from nums_until_10
expect $nums_until_10 to_not_include 1 and
expect $nums_until_10 to_not_include 2
end
function it_erases_multiple_elements_from_multiple_lists
list.erase 1 2 --from nums_until_10 odds_until_10
expect $nums_until_10 to_not_include 1 and
expect $nums_until_10 to_not_include 2 and
expect $odds_until_10 to_not_include 1
end
end
import plugins/fish-spec
test/oh_my_fish.fish
→
test/oh_my_fish.
test.
fish
View file @
fed8c863
...
...
@@ -34,15 +34,14 @@ function describe_oh_my_fish
end
function it_loads_all_oh_my_fish_functions
array.delete "$fish_path/functions/"
fish_function_path
list.erase "$fish_path/functions/" --from
fish_function_path
load_oh_my_fish
expect $fish_function_path to_include $fish_path/functions/
end
function it_loads_all_selected_plugins
array.delete "$fish_path/plugins/bak" fish_function_path
array.delete "$fish_path/plugins/z" fish_function_path
list.erase "$fish_path/plugins/bak" "$fish_path/plugins/z" --from fish_function_path
set fish_plugins bak z
load_oh_my_fish
...
...
@@ -51,7 +50,7 @@ function describe_oh_my_fish
end
function it_loads_plugins_from_custom_folder
array.delete "$fish_custom/plugins/example"
fish_function_path
list.erase "$fish_custom/plugins/example" --from
fish_function_path
set fish_plugins example
load_oh_my_fish
...
...
@@ -59,7 +58,7 @@ function describe_oh_my_fish
end
function it_loads_the_selected_theme
array.delete "$fish_path/themes/l"
fish_function_path
list.erase "$fish_path/themes/l" --from
fish_function_path
set fish_theme l
load_oh_my_fish
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment