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
58daae02
Commit
58daae02
authored
Dec 19, 2015
by
Bruno Pinto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve assertion error messages
parent
148ce423
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
11 deletions
+11
-11
pkg/fish-spec/functions/assert.error_message.fish
pkg/fish-spec/functions/assert.error_message.fish
+6
-6
pkg/fish-spec/spec/assert_error_message_spec.fish
pkg/fish-spec/spec/assert_error_message_spec.fish
+5
-5
No files found.
pkg/fish-spec/functions/assert.error_message.fish
View file @
58daae02
...
...
@@ -6,26 +6,26 @@ function assert.error_message
switch $number_of_arguments
case 3
set operator (assert.expand_operator $argv[2])
set
expected
$argv[3]
echo "Expected
$expected to not be $operator
"
set
actual
$argv[3]
echo "Expected
result to not be $operator but it was $actual
"
case 4
set expected $argv[2]
set operator "not" (assert.expand_operator $argv[3])
set actual $argv[4]
echo "Expected
$expected to $operator
$actual"
echo "Expected
result to $operator $expected but it was
$actual"
case \*
return 1
end
case \-\*
test $number_of_arguments != 2; and return 1
set operator (assert.expand_operator $argv[1])
set
expected
$argv[2]
echo "Expected
$expected to be $operator
"
set
actual
$argv[2]
echo "Expected
result to be $operator but it was $actual
"
case \*
test $number_of_arguments != 3; and return 1
set expected $argv[1]
set operator (assert.expand_operator $argv[2])
set actual $argv[3]
echo "Expected
$expected to $operator
$actual"
echo "Expected
result to $operator $expected but it was
$actual"
end
end
pkg/fish-spec/spec/assert_error_message_spec.fish
View file @
58daae02
...
...
@@ -17,12 +17,12 @@ function describe_assert_error_message
end
function it_supports_unary_operators
assert -z "
string
"
assert -z "
abc
"
# Reset test status
set -e __current_spec_status
assert 'Expected
string to be empty
' = "$__current_spec_output"
assert 'Expected
result to be empty but it was abc
' = "$__current_spec_output"
end
function it_supports_binary_operators
...
...
@@ -31,7 +31,7 @@ function describe_assert_error_message
# Reset test status
set -e __current_spec_status
assert 'Expected
1 to equal
s 2' = "$__current_spec_output"
assert 'Expected
result to equals 1 but it wa
s 2' = "$__current_spec_output"
end
function it_supports_inversion_on_unary_operators
...
...
@@ -40,7 +40,7 @@ function describe_assert_error_message
# Reset test status
set -e __current_spec_status
assert 'Expected
to not be empty
' = "$__current_spec_output"
assert 'Expected
result to not be empty but it was
' = "$__current_spec_output"
end
function it_supports_inversion_on_binary_operators
...
...
@@ -49,6 +49,6 @@ function describe_assert_error_message
# Reset test status
set -e __current_spec_status
assert 'Expected
1 to not equal
s 1' = "$__current_spec_output"
assert 'Expected
result to not equals 1 but it wa
s 1' = "$__current_spec_output"
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