mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Return 1 on failure
This commit is contained in:
parent
487726ea54
commit
87ca825845
2 changed files with 9 additions and 3 deletions
|
@ -69,7 +69,9 @@ module Spectator
|
||||||
# Crystal doesn't display much information about what happened.
|
# Crystal doesn't display much information about what happened.
|
||||||
# That issue is handled by putting a begin/rescue block to show a custom error message.
|
# That issue is handled by putting a begin/rescue block to show a custom error message.
|
||||||
at_exit do
|
at_exit do
|
||||||
run if autorun?
|
# Run only if `#autorun?` is true.
|
||||||
|
# Return 1 on failure.
|
||||||
|
exit(1) if autorun? && !run
|
||||||
end
|
end
|
||||||
|
|
||||||
@@config_builder = ConfigBuilder.new
|
@@config_builder = ConfigBuilder.new
|
||||||
|
@ -94,7 +96,7 @@ module Spectator
|
||||||
# it's likely the fault of the test framework (Spectator).
|
# it's likely the fault of the test framework (Spectator).
|
||||||
# So we display a helpful error that could be reported and return non-zero.
|
# So we display a helpful error that could be reported and return non-zero.
|
||||||
display_error_stack(ex)
|
display_error_stack(ex)
|
||||||
exit(1)
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
# Processes and builds up a configuration to use for running tests.
|
# Processes and builds up a configuration to use for running tests.
|
||||||
|
|
|
@ -9,7 +9,9 @@ module Spectator
|
||||||
# Runs the test suite.
|
# Runs the test suite.
|
||||||
# This will run the selected examples
|
# This will run the selected examples
|
||||||
# and invoke the formatter to output results.
|
# and invoke the formatter to output results.
|
||||||
def run : Nil
|
# True will be returned if the test suite ran successfully,
|
||||||
|
# or false if there was at least one failure.
|
||||||
|
def run : Bool
|
||||||
# Indicate the suite is starting.
|
# Indicate the suite is starting.
|
||||||
@config.formatter.start_suite(@suite)
|
@config.formatter.start_suite(@suite)
|
||||||
|
|
||||||
|
@ -24,6 +26,8 @@ module Spectator
|
||||||
# Generate a report and pass it along to the formatter.
|
# Generate a report and pass it along to the formatter.
|
||||||
report = Report.new(results, elapsed)
|
report = Report.new(results, elapsed)
|
||||||
@config.formatter.end_suite(report)
|
@config.formatter.end_suite(report)
|
||||||
|
|
||||||
|
!report.failed?
|
||||||
end
|
end
|
||||||
|
|
||||||
# Runs a single example and returns the result.
|
# Runs a single example and returns the result.
|
||||||
|
|
Loading…
Reference in a new issue