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
99ea3a69
Commit
99ea3a69
authored
Jan 20, 2015
by
Bruno Pinto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simplifying expect tests
parent
b8252160
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
72 additions
and
88 deletions
+72
-88
plugins/fish-spec/spec/expect.to_be_false.spec.fish
plugins/fish-spec/spec/expect.to_be_false.spec.fish
+12
-12
plugins/fish-spec/spec/expect.to_be_true.spec.fish
plugins/fish-spec/spec/expect.to_be_true.spec.fish
+12
-12
plugins/fish-spec/spec/expect.to_contain_all.spec.fish
plugins/fish-spec/spec/expect.to_contain_all.spec.fish
+16
-28
plugins/fish-spec/spec/expect.to_equal.spec.fish
plugins/fish-spec/spec/expect.to_equal.spec.fish
+8
-16
plugins/fish-spec/spec/expect.to_not_contain_all.spec.fish
plugins/fish-spec/spec/expect.to_not_contain_all.spec.fish
+24
-20
No files found.
plugins/fish-spec/spec/expect.to_be_false.spec.fish
View file @
99ea3a69
import plugins/fish-spec
function describe_expect_to_be_false
function before_each
set -e result
end
function it_returns_1_when_evaluated_value_is_0
echo (expect true --to-be-false; set result $status) >/dev/null
expect $result --to-equal 1
expect true --to-be-false
expect $status --to-equal 1
end
function it_returns_0_when_evaluated_value_is_1
echo (expect false --to-be-false; set result $status) >/dev/null
expect $result --to-equal 0
expect false --to-be-false
expect $status --to-equal 0
end
function it_returns_1_when_evaluated_function_returns_0
echo (expect "eval true" --to-be-false; set result $status) >/dev/null
expect $result --to-equal 1
expect "eval true" --to-be-false
expect $status --to-equal 1
end
function it_returns_0_when_evaluated_function_returns_1
echo (expect "eval false" --to-be-false; set result $status) >/dev/null
expect $result --to-equal 0
expect "eval false" --to-be-false
expect $status --to-equal 0
end
end
...
...
plugins/fish-spec/spec/expect.to_be_true.spec.fish
View file @
99ea3a69
import plugins/fish-spec
function describe_expect_to_be_true
function before_each
set -e result
end
function it_returns_0_when_evaluated_value_returns_0
echo (expect true --to-be-true; set result $status) >/dev/null
expect $result --to-equal 0
expect true --to-be-true
expect $status --to-equal 0
end
function it_returns_1_when_evaluated_value_returns_1
echo (expect false --to-be-true; set result $status) >/dev/null
expect $result --to-equal 1
expect false --to-be-true
expect $status --to-equal 1
end
function it_returns_0_when_evaluated_function_returns_0
echo (expect "eval true" --to-be-true; set result $status) >/dev/null
expect $result --to-equal 0
expect "eval true" --to-be-true
expect $status --to-equal 0
end
function it_returns_1_when_evaluated_function_returns_1
echo (expect "eval false" --to-be-true; set result $status) >/dev/null
expect $result --to-equal 1
expect "eval false" --to-be-true
expect $status --to-equal 1
end
end
...
...
plugins/fish-spec/spec/expect.to_contain_all.spec.fish
View file @
99ea3a69
import plugins/fish-spec
function describe_expect_to_contain_all
function before_each
set -e result
end
function it_returns_0_when_lists_are_the_same
set -l array
1 2
expect 1 2 --to-contain-all
1 2
echo (expect $array --to-contain-all $array; set result $status) >/dev/null
expect $result --to-equal 0
expect $status --to-equal 0
end
function it_returns_1_when_lists_are_different
set -l array 1 2
expect 1 2 --to-contain-all 8 9
echo (expect $array --to-contain-all 8 9; set result $status) >/dev/null
expect $result --to-equal 1
expect $status --to-equal 1
end
function it_returns_0_when_lists_have_the_same_item_but_in_different_order
set -l array 1 2
expect 1 2 --to-contain-all 2 1
echo (expect $array --to-contain-all 2 1; set result $status) >/dev/null
expect $result --to-equal 0
expect $status --to-equal 0
end
function it_returns_0_when_expected_list_contains_the_item
set -l array 1 2
expect 1 2 --to-contain-all 1
echo (expect $array --to-contain-all 1; set result $status) >/dev/null
expect $result --to-equal 0
expect $status --to-equal 0
end
function it_returns_1_when_expected_list_does_not_contain_the_item
set -l array 1 2
expect 1 2 --to-contain-all 9
echo (expect $array --to-contain-all 9; set result $status) >/dev/null
expect $result --to-equal 1
expect $status --to-equal 1
end
function it_returns_0_when_expected_list_contains_all_items
set -l array 1 2 3
expect 1 2 3 --to-contain-all 1 2
echo (expect $array --to-contain-all 1 2; set result $status) >/dev/null
expect $result --to-equal 0
expect $status --to-equal 0
end
function it_returns_1_when_expected_list_does_not_contain_all_items
set -l array 1 2 3
expect 1 2 3 --to-contain-all 1 2 9
echo (expect $array --to-contain-all 1 2 9; set result $status) >/dev/null
expect $result --to-equal 1
expect $status --to-equal 1
end
function it_returns_1_when_expected_list_contains_less_items
set -l array 1 2
expect 1 2 --to-contain-all 1 2 9
echo (expect $array --to-contain-all 1 2 9; set result $status) >/dev/null
expect $result --to-equal 1
expect $status --to-equal 1
end
end
...
...
plugins/fish-spec/spec/expect.to_equal.spec.fish
View file @
99ea3a69
import plugins/fish-spec
function describe_expect_to_equal
function before_each
set -e result
end
function it_returns_0_when_compared_values_are_the_same
set -l equal "equal"
expect 'equal' --to-equal 'equal'
echo (expect $equal --to-equal $equal; set result $status) >/dev/null
expect $result --to-equal 0
expect $status --to-equal 0
end
function it_returns_1_when_compared_values_are_different
set -l equal "equal"
expect 'equal' --to-equal 'different'
echo (expect $equal --to-equal 'different'; set result $status) >/dev/null
expect $result --to-equal 1
expect $status --to-equal 1
end
function it_returns_0_when_list_items_are_in_the_same_order
set -l array
1 2
expect 1 2 --to-equal
1 2
echo (expect $array --to-equal 1 2; set result $status) >/dev/null
expect $result --to-equal 0
expect $status --to-equal 0
end
function it_returns_1_when_list_items_are_in_different_order
set -l array 1 2
expect 1 2 --to-equal 2 1
echo (expect $array --to-equal 2 1; set result $status) >/dev/null
expect $result --to-equal 1
expect $status --to-equal 1
end
end
...
...
plugins/fish-spec/spec/expect.to_not_contain_all.spec.fish
View file @
99ea3a69
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
expect 1 2 --to-not-contain-all 1 2
expect $status --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
expect 1 2 --to-not-contain-all 8 9
expect $status --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
expect 1 2 --to-not-contain-all 2 1
expect $status --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
expect 1 2 --to-not-contain-all 1
expect $status --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
expect 1 2 --to-not-contain-all 9
expect $status --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
expect 1 2 3 --to-not-contain-all 1 2
expect $status --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
expect 1 2 3 --to-not-contain-all 8 9
expect $status --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
expect 1 2 --to-not-contain-all 1 2 9
expect $status --to-equal 0
end
end
...
...
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