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
5e2f42c3
Commit
5e2f42c3
authored
Jan 17, 2015
by
Bruno Pinto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Closes #322: rename to-(not-)contain to to-(not-)contain-all
parent
9a7292ac
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
86 additions
and
102 deletions
+86
-102
plugins/bak/spec/bak.spec.fish
plugins/bak/spec/bak.spec.fish
+4
-4
plugins/fish-spec/expect.fish
plugins/fish-spec/expect.fish
+8
-8
plugins/fish-spec/spec/expect.to_contain_all.spec.fish
plugins/fish-spec/spec/expect.to_contain_all.spec.fish
+9
-9
plugins/fish-spec/spec/expect.to_not_contain.spec.fish
plugins/fish-spec/spec/expect.to_not_contain.spec.fish
+0
-65
plugins/fish-spec/spec/expect.to_not_contain_all.spec.fish
plugins/fish-spec/spec/expect.to_not_contain_all.spec.fish
+49
-0
plugins/fish-spec/spec/list.erase.spec.fish
plugins/fish-spec/spec/list.erase.spec.fish
+12
-12
spec/oh-my-fish.spec.fish
spec/oh-my-fish.spec.fish
+4
-4
No files found.
plugins/bak/spec/bak.spec.fish
View file @
5e2f42c3
...
@@ -65,7 +65,7 @@ function describe_bak_plugin
...
@@ -65,7 +65,7 @@ function describe_bak_plugin
touch a
touch a
cpbak a
cpbak a
expect (ls -p) --to-contain (echo 'a'\n(__bak_name a))
expect (ls -p) --to-contain
-all
(echo 'a'\n(__bak_name a))
end
end
function it_copies_multiple_files
function it_copies_multiple_files
...
@@ -77,7 +77,7 @@ function describe_bak_plugin
...
@@ -77,7 +77,7 @@ function describe_bak_plugin
set files_bak $files_bak (__bak_name $f)
set files_bak $files_bak (__bak_name $f)
end
end
expect (ls) --to-contain $files $file_bak
expect (ls) --to-contain
-all
$files $file_bak
end
end
function it_undo_copies_of_a_single_file
function it_undo_copies_of_a_single_file
...
@@ -86,7 +86,7 @@ function describe_bak_plugin
...
@@ -86,7 +86,7 @@ function describe_bak_plugin
rm a
rm a
uncpbak (ls)
uncpbak (ls)
expect (ls) --to-contain (echo 'a'\n(__bak_name a))
expect (ls) --to-contain
-all
(echo 'a'\n(__bak_name a))
end
end
function it_undo_copies_of_multiple_files
function it_undo_copies_of_multiple_files
...
@@ -104,7 +104,7 @@ function describe_bak_plugin
...
@@ -104,7 +104,7 @@ function describe_bak_plugin
rmdir a
rmdir a
uncpbak (ls -p)
uncpbak (ls -p)
expect (ls -p) --to-contain (echo 'a/'\n(__bak_name a)'/')
expect (ls -p) --to-contain
-all
(echo 'a/'\n(__bak_name a)'/')
end
end
end
end
...
...
plugins/fish-spec/expect.fish
View file @
5e2f42c3
...
@@ -7,13 +7,13 @@
...
@@ -7,13 +7,13 @@
# OPTIONS
# OPTIONS
# <expected>...
# <expected>...
# <condition>
# <condition>
# --to-equal <actual> value equals <expected> value
# --to-equal
<actual> value equals <expected> value
# --to-not-equal <actual> value does not equals <expected> value
# --to-not-equal
<actual> value does not equals <expected> value
#
#
# --to-contain
<actual> values exist in <expected> list
# --to-contain
-all all
<actual> values exist in <expected> list
# --to-not-contain
<actual> values does not exist in <expected> list
# --to-not-contain
-all all
<actual> values does not exist in <expected> list
# --to-be-true exit status should be truthy
# --to-be-true
exit status should be truthy
# --to-be-false exit status should be falsy
# --to-be-false
exit status should be falsy
# <actual>...
# <actual>...
#
#
# EXAMPLE
# EXAMPLE
...
@@ -60,14 +60,14 @@ function expect
...
@@ -60,14 +60,14 @@ function expect
case --to-be-true
case --to-be-true
eval "$expected"
eval "$expected"
test $status -eq 0
test $status -eq 0
case --to-contain
case --to-contain
-all
set result 0
set result 0
for item in $actual
for item in $actual
contains -- "$item" $expected
contains -- "$item" $expected
or set result $status
or set result $status
end
end
test $result -eq 0
test $result -eq 0
case --to-not-contain
case --to-not-contain
-all
set result 0
set result 0
for item in $actual
for item in $actual
contains -- "$item" $expected
contains -- "$item" $expected
...
...
plugins/fish-spec/spec/expect.to_contain.spec.fish
→
plugins/fish-spec/spec/expect.to_contain
_all
.spec.fish
View file @
5e2f42c3
import plugins/fish-spec
import plugins/fish-spec
function describe_expect_to_contain
function describe_expect_to_contain
_all
function before_each
function before_each
set -e result
set -e result
end
end
...
@@ -8,56 +8,56 @@ function describe_expect_to_contain
...
@@ -8,56 +8,56 @@ function describe_expect_to_contain
function it_returns_0_when_lists_are_the_same
function it_returns_0_when_lists_are_the_same
set -l array 1 2
set -l array 1 2
echo (expect $array --to-contain $array; set result $status) >/dev/null
echo (expect $array --to-contain
-all
$array; set result $status) >/dev/null
expect $result --to-equal 0
expect $result --to-equal 0
end
end
function it_returns_1_when_lists_are_different
function it_returns_1_when_lists_are_different
set -l array 1 2
set -l array 1 2
echo (expect $array --to-contain 8 9; set result $status) >/dev/null
echo (expect $array --to-contain
-all
8 9; set result $status) >/dev/null
expect $result --to-equal 1
expect $result --to-equal 1
end
end
function it_returns_0_when_lists_have_the_same_item_but_in_different_order
function it_returns_0_when_lists_have_the_same_item_but_in_different_order
set -l array 1 2
set -l array 1 2
echo (expect $array --to-contain 2 1; set result $status) >/dev/null
echo (expect $array --to-contain
-all
2 1; set result $status) >/dev/null
expect $result --to-equal 0
expect $result --to-equal 0
end
end
function it_returns_0_when_expected_list_contains_the_item
function it_returns_0_when_expected_list_contains_the_item
set -l array 1 2
set -l array 1 2
echo (expect $array --to-contain 1; set result $status) >/dev/null
echo (expect $array --to-contain
-all
1; set result $status) >/dev/null
expect $result --to-equal 0
expect $result --to-equal 0
end
end
function it_returns_1_when_expected_list_does_not_contain_the_item
function it_returns_1_when_expected_list_does_not_contain_the_item
set -l array 1 2
set -l array 1 2
echo (expect $array --to-contain 9; set result $status) >/dev/null
echo (expect $array --to-contain
-all
9; set result $status) >/dev/null
expect $result --to-equal 1
expect $result --to-equal 1
end
end
function it_returns_0_when_expected_list_contains_all_items
function it_returns_0_when_expected_list_contains_all_items
set -l array 1 2 3
set -l array 1 2 3
echo (expect $array --to-contain 1 2; set result $status) >/dev/null
echo (expect $array --to-contain
-all
1 2; set result $status) >/dev/null
expect $result --to-equal 0
expect $result --to-equal 0
end
end
function it_returns_1_when_expected_list_does_not_contain_all_items
function it_returns_1_when_expected_list_does_not_contain_all_items
set -l array 1 2 3
set -l array 1 2 3
echo (expect $array --to-contain 1 2 9; set result $status) >/dev/null
echo (expect $array --to-contain
-all
1 2 9; set result $status) >/dev/null
expect $result --to-equal 1
expect $result --to-equal 1
end
end
function it_returns_1_when_expected_list_contains_less_items
function it_returns_1_when_expected_list_contains_less_items
set -l array 1 2
set -l array 1 2
echo (expect $array --to-contain 1 2 9; set result $status) >/dev/null
echo (expect $array --to-contain
-all
1 2 9; set result $status) >/dev/null
expect $result --to-equal 1
expect $result --to-equal 1
end
end
end
end
...
...
plugins/fish-spec/spec/expect.to_not_contain.spec.fish
deleted
100644 → 0
View file @
9a7292ac
import plugins/fish-spec
function describe_expect_to_not_contain
function before_each
set -e result
end
function it_returns_1_when_lists_are_the_same
set -l list 1 2
echo (expect $list --to-not-contain $list; set result $status) >/dev/null
expect $result --to-equal 1
end
function it_returns_0_when_lists_are_different
set -l list 1 2
echo (expect $list --to-not-contain 8 9; set result $status) >/dev/null
expect $result --to-equal 0
end
function it_returns_1_when_lists_have_the_same_items_but_in_different_order
set -l list 1 2
echo (expect $list --to-not-contain 2 1; set result $status) >/dev/null
expect $result --to-equal 1
end
function it_returns_1_when_expected_list_contains_an_item
set -l list 1 2
echo (expect $list --to-not-contain 1; set result $status) >/dev/null
expect $result --to-equal 1
end
function it_returns_0_when_expected_list_does_not_contain_an_item
set -l list 1 2
echo (expect $list --to-not-contain 9; set result $status) >/dev/null
expect $result --to-equal 0
end
function it_returns_1_when_expected_list_contains_all_items
set -l list 1 2 3
echo (expect $list --to-not-contain 1 2; set result $status) >/dev/null
expect $result --to-equal 1
end
function it_returns_0_when_expected_array_does_not_contain_any_items
set -l list 1 2 3
echo (expect $list --to-not-contain 1 2 9; set result $status) >/dev/null
expect $result --to-equal 0
end
function it_returns_0_when_expected_array_contains_less_items
set -l list 1 2
echo (expect $list --to-not-contain 1 2 9; set result $status)
expect $result --to-equal 0
end
end
spec.run $argv
plugins/fish-spec/spec/expect.to_not_contain_all.spec.fish
0 → 100644
View file @
5e2f42c3
import plugins/fish-spec
function describe_expect_to_not_contain_all
function before_each
set -e result
end
function it_is_false_when_lists_are_the_same
echo (expect 1 2 --to-not-contain-all 1 2; set result $status) >/dev/null
expect $result --to-equal 1
end
function it_is_true_when_lists_are_different
echo (expect 1 2 --to-not-contain-all 8 9; set result $status) >/dev/null
expect $result --to-equal 0
end
function it_is_false_when_lists_have_the_same_items_but_in_different_order
echo (expect 1 2 --to-not-contain-all 2 1; set result $status) >/dev/null
expect $result --to-equal 1
end
function it_is_false_when_expected_list_contains_an_item
echo (expect 1 2 --to-not-contain-all 1; set result $status) >/dev/null
expect $result --to-equal 1
end
function it_is_true_when_expected_list_does_not_contain_an_item
echo (expect 1 2 --to-not-contain-all 9; set result $status) >/dev/null
expect $result --to-equal 0
end
function it_is_false_when_expected_list_contains_all_items
echo (expect 1 2 3 --to-not-contain-all 1 2; set result $status) >/dev/null
expect $result --to-equal 1
end
function it_is_true_when_expected_array_does_not_contain_any_items
echo (expect 1 2 3 --to-not-contain-all 8 9; set result $status) >/dev/null
expect $result --to-equal 0
end
function it_is_true_when_expected_array_contains_less_items
echo (expect 1 2 --to-not-contain-all 1 2 9; set result $status)
expect $result --to-equal 0
end
end
spec.run $argv
plugins/fish-spec/spec/list.erase.spec.fish
View file @
5e2f42c3
...
@@ -8,42 +8,42 @@ function describe_list.erase
...
@@ -8,42 +8,42 @@ function describe_list.erase
function it_erases_one_element
function it_erases_one_element
list.erase 1 nums_until_10
list.erase 1 nums_until_10
expect $nums_until_10 --to-not-contain 1
expect $nums_until_10 --to-not-contain
-all
1
end
end
function it_erases_one_element_without_from_option
function it_erases_one_element_without_from_option
list.erase 1 --from nums_until_10
list.erase 1 --from nums_until_10
expect $nums_until_10 --to-not-contain 1
expect $nums_until_10 --to-not-contain
-all
1
end
end
function it_erases_one_element_from_multiple_lists
function it_erases_one_element_from_multiple_lists
list.erase 1 --from nums_until_10 odds_until_10
list.erase 1 --from nums_until_10 odds_until_10
expect $nums_until_10 --to-not-contain 1
expect $nums_until_10 --to-not-contain
-all
1
and expect $odds_until_10 --to-not-contain 1
and expect $odds_until_10 --to-not-contain
-all
1
end
end
function it_erases_one_element_from_multiple_lists_when_only_one_has_the_element
function it_erases_one_element_from_multiple_lists_when_only_one_has_the_element
list.erase 2 --from nums_until_10 odds_until_10
list.erase 2 --from nums_until_10 odds_until_10
expect $nums_until_10 --to-not-contain 2
expect $nums_until_10 --to-not-contain
-all
2
end
end
function it_erases_multiple_elements
function it_erases_multiple_elements
list.erase 1 2 nums_until_10
list.erase 1 2 nums_until_10
expect $nums_until_10 --to-not-contain 1
expect $nums_until_10 --to-not-contain
-all
1
and expect $nums_until_10 --to-not-contain 2
and expect $nums_until_10 --to-not-contain
-all
2
end
end
function it_erases_multiple_elements_with_from_syntax
function it_erases_multiple_elements_with_from_syntax
list.erase 1 2 --from nums_until_10
list.erase 1 2 --from nums_until_10
expect $nums_until_10 --to-not-contain 1
expect $nums_until_10 --to-not-contain
-all
1
and expect $nums_until_10 --to-not-contain 2
and expect $nums_until_10 --to-not-contain
-all
2
end
end
function it_erases_multiple_elements_from_multiple_lists
function it_erases_multiple_elements_from_multiple_lists
list.erase 1 2 --from nums_until_10 odds_until_10
list.erase 1 2 --from nums_until_10 odds_until_10
expect $nums_until_10 --to-not-contain 1
expect $nums_until_10 --to-not-contain
-all
1
and expect $nums_until_10 --to-not-contain 2
and expect $nums_until_10 --to-not-contain
-all
2
and expect $odds_until_10 --to-not-contain 1
and expect $odds_until_10 --to-not-contain
-all
1
end
end
function it_returns_0_if_any_items_are_erased
function it_returns_0_if_any_items_are_erased
...
...
spec/oh-my-fish.spec.fish
View file @
5e2f42c3
...
@@ -37,7 +37,7 @@ function describe_oh_my_fish
...
@@ -37,7 +37,7 @@ function describe_oh_my_fish
list.erase "$fish_path/functions/" --from fish_function_path
list.erase "$fish_path/functions/" --from fish_function_path
load_oh_my_fish
load_oh_my_fish
expect $fish_function_path --to-contain $fish_path/functions/
expect $fish_function_path --to-contain
-all
$fish_path/functions/
end
end
function it_loads_all_selected_plugins
function it_loads_all_selected_plugins
...
@@ -46,8 +46,8 @@ function describe_oh_my_fish
...
@@ -46,8 +46,8 @@ function describe_oh_my_fish
set -g fish_plugins bak z
set -g fish_plugins bak z
load_oh_my_fish
load_oh_my_fish
expect $fish_function_path --to-contain $fish_path/plugins/bak
expect $fish_function_path --to-contain
-all
$fish_path/plugins/bak
expect $fish_function_path --to-contain $fish_path/plugins/z
expect $fish_function_path --to-contain
-all
$fish_path/plugins/z
end
end
function it_loads_the_selected_theme
function it_loads_the_selected_theme
...
@@ -55,7 +55,7 @@ function describe_oh_my_fish
...
@@ -55,7 +55,7 @@ function describe_oh_my_fish
set fish_theme l
set fish_theme l
load_oh_my_fish
load_oh_my_fish
expect $fish_function_path --to-contain $fish_path/themes/l
expect $fish_function_path --to-contain
-all
$fish_path/themes/l
end
end
function it_reloads_with_status_of_0
function it_reloads_with_status_of_0
...
...
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