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
8fac0ca4
Commit
8fac0ca4
authored
Dec 19, 2015
by
Bruno Pinto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve failure reports
Show name of the test that failed with the failure message.
parent
3d1a90e2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
18 deletions
+16
-18
pkg/fish-spec/basic_formatter.fish
pkg/fish-spec/basic_formatter.fish
+9
-7
pkg/fish-spec/spec/assert_error_message_spec.fish
pkg/fish-spec/spec/assert_error_message_spec.fish
+7
-7
pkg/fish-spec/spec/results_spec.fish
pkg/fish-spec/spec/results_spec.fish
+0
-4
No files found.
pkg/fish-spec/basic_formatter.fish
View file @
8fac0ca4
function __fish-spec.spec_init -e spec_init -a spec
set -g __current_spec_name (echo $spec | sed 's/^[0-9]*_//;s/_/ /g;s/^it/It/')
set -e __current_spec_output
set -e __current_spec_status
end
...
...
@@ -20,7 +22,12 @@ function __fish-spec.spec_success -e spec_success
end
function __fish-spec.spec_error -e spec_error
echo -n 'F'
echo -e "\n\nFailure: $__current_spec_name"
if not set -q __current_spec_quiet
echo (omf::em) $__current_spec_output(omf::off)
end
set -g __any_spec_failed true
end
...
...
@@ -34,11 +41,6 @@ end
function __fish-spec_assertion_error -e assertion_error -a error_message
# Mimics output redirect inside an event handler
if set -q __fish_spec_output
set __fish_spec_output $error_message
else
echo $error_message
end
set -g __current_spec_output $error_message
set -g __current_spec_status error
end
pkg/fish-spec/spec/assert_error_message_spec.fish
View file @
8fac0ca4
function describe_assert_error_message
function before_each
set -g __
fish_spec_output "initial test value"
set -g __
current_spec_quiet
end
function after_each
set -e __
fish_spec_outpu
t
set -e __
current_spec_quie
t
end
function it_has_no_output_when_the_test_succeeds
...
...
@@ -13,7 +13,7 @@ function describe_assert_error_message
# Reset test status
set -e __current_spec_status
assert
'initial test value' = "$__fish_spec_output"; or echo $__fish_spec_output
assert
-z "$__current_spec_output"
end
function it_supports_unary_operators
...
...
@@ -22,7 +22,7 @@ function describe_assert_error_message
# Reset test status
set -e __current_spec_status
assert 'Expected string to be empty' = "$__
fish_spec_output"; or echo $__fish_spec_output
assert 'Expected string to be empty' = "$__
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 equals 2' = "$__
fish_spec_output"; or echo $__fish_spec_output
assert 'Expected 1 to equals 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' = "$__
fish_spec_output"; or echo $__fish_spec_output
assert 'Expected to not be empty' = "$__
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 equals 1' = "$__
fish_spec_output"; or echo $__fish_spec_output
assert 'Expected 1 to not equals 1' = "$__
current_spec_output"
end
end
pkg/fish-spec/spec/results_spec.fish
View file @
8fac0ca4
function describe_results
function after_each
set -e __fish_spec_quiet
end
function it_succeeds_when_single_assertion_succeeds
assert 1 = 1
...
...
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