Get harness compiling again

This commit is contained in:
Michael Miller 2021-01-16 11:03:05 -07:00
parent 175ce8f293
commit 0992bad7eb
No known key found for this signature in database
GPG key ID: FB9F12F7C646A4AD

View file

@ -15,18 +15,20 @@ module Spectator
# This sets up the harness so that the test code can use it. # This sets up the harness so that the test code can use it.
# The framework does the following: # The framework does the following:
# ``` # ```
# result = Harness.run { delegate.call(example) } # result = Harness.run { run_example_code }
# # Do something with the result. # # Do something with the result.
# ``` # ```
#
# Then from the test code, the harness can be accessed via `.current` like so: # Then from the test code, the harness can be accessed via `.current` like so:
# ``` # ```
# harness = ::Spectator::Harness.current # harness = ::Spectator::Harness.current
# # Do something with the harness. # # Do something with the harness.
# ``` # ```
#
# Of course, the end-user shouldn't see this or work directly with the harness. # Of course, the end-user shouldn't see this or work directly with the harness.
# Instead, methods the user calls can access it. # Instead, methods the test calls can access it.
# For instance, an assertion reporting a result. # For instance, an expectation reporting a result.
private class Harness class Harness
# Retrieves the harness for the current running example. # Retrieves the harness for the current running example.
class_getter! current : self class_getter! current : self
@ -54,6 +56,10 @@ module Spectator
translate(*outcome) translate(*outcome)
end end
def report(expectation)
# TODO
end
# Stores a block of code to be executed later. # Stores a block of code to be executed later.
# All deferred blocks run just before the `#run` method completes. # All deferred blocks run just before the `#run` method completes.
def defer(&block) : Nil def defer(&block) : Nil