Adjust (mostly remove) explicit return types

This commit is contained in:
Michael Miller 2019-02-17 23:12:16 -07:00
parent b646b8bec5
commit f2c17189fc
6 changed files with 8 additions and 8 deletions

View file

@ -118,7 +118,7 @@ module Spectator
end end
# Checks whether all examples in the group have been run. # Checks whether all examples in the group have been run.
def finished? : Bool def finished?
children.all?(&.finished?) children.all?(&.finished?)
end end

View file

@ -52,7 +52,7 @@ module Spectator
# in addition to a block passed to this method. # in addition to a block passed to this method.
# To call the block and all "around-each" hooks, # To call the block and all "around-each" hooks,
# just invoke `Proc#call` on the returned proc. # just invoke `Proc#call` on the returned proc.
def wrap_around_each(&block : ->) def wrap_around_each(&block : ->) : ->
wrapper = block wrapper = block
# Must wrap in reverse order, # Must wrap in reverse order,
# otherwise hooks will run in the wrong order. # otherwise hooks will run in the wrong order.

View file

@ -5,7 +5,7 @@ module Spectator
# This class will not run example code. # This class will not run example code.
abstract class PendingExample < Example abstract class PendingExample < Example
# Returns a pending result. # Returns a pending result.
private def run_impl : Result private def run_impl
PendingResult.new(self) PendingResult.new(self)
end end
end end

View file

@ -5,7 +5,7 @@ module Spectator
# The root has no parent. # The root has no parent.
class RootExampleGroup < ExampleGroup class RootExampleGroup < ExampleGroup
# Dummy value - this should never be used. # Dummy value - this should never be used.
def what : String def what
"ROOT" "ROOT"
end end

View file

@ -8,7 +8,7 @@ module Spectator
abstract class RunnableExample < Example abstract class RunnableExample < Example
# Runs the example, hooks, and captures the result # Runs the example, hooks, and captures the result
# and translates to a usable result. # and translates to a usable result.
def run_impl : Result def run_impl
result = capture_result result = capture_result
expectations = Internals::Harness.current.expectations expectations = Internals::Harness.current.expectations
translate_result(result, expectations) translate_result(result, expectations)
@ -35,7 +35,7 @@ module Spectator
# Runs all hooks and the example code. # Runs all hooks and the example code.
# A captured result is returned. # A captured result is returned.
private def capture_result : ResultCapture private def capture_result
ResultCapture.new.tap do |result| ResultCapture.new.tap do |result|
# Get the proc that will call around-each hooks and the example. # Get the proc that will call around-each hooks and the example.
wrapper = wrap_run_example(result) wrapper = wrap_run_example(result)
@ -57,7 +57,7 @@ module Spectator
# Creates a proc that runs the test code # Creates a proc that runs the test code
# and captures the result. # and captures the result.
private def wrap_run_example(result) : -> private def wrap_run_example(result)
# Wrap the method that runs and captures # Wrap the method that runs and captures
# the test code with the around-each hooks. # the test code with the around-each hooks.
group.wrap_around_each_hooks do group.wrap_around_each_hooks do

View file

@ -28,7 +28,7 @@ module Spectator
# Runs a single example and returns the result. # Runs a single example and returns the result.
# The formatter is given the example and result information. # The formatter is given the example and result information.
private def run_example(example) : Result private def run_example(example)
@config.formatter.start_example(example) @config.formatter.start_example(example)
Internals::Harness.run(example).tap do |result| Internals::Harness.run(example).tap do |result|
@config.formatter.end_example(result) @config.formatter.end_example(result)