mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Move harness out of internals
This commit is contained in:
parent
0067191423
commit
7e6080aa5f
4 changed files with 6 additions and 6 deletions
|
@ -40,7 +40,7 @@ module Spectator::Expectations
|
||||||
# Reports an expectation to the current harness.
|
# Reports an expectation to the current harness.
|
||||||
private def report(match_data : Matchers::MatchData)
|
private def report(match_data : Matchers::MatchData)
|
||||||
expectation = Expectation.new(match_data, @source)
|
expectation = Expectation.new(match_data, @source)
|
||||||
Internals::Harness.current.report_expectation(expectation)
|
Harness.current.report_expectation(expectation)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module Spectator::Internals
|
module Spectator
|
||||||
# Helper class that acts as a gateway between example code and the test framework.
|
# Helper class that acts as a gateway between example code and the test framework.
|
||||||
# Every example must be invoked by passing it to `#run`.
|
# Every example must be invoked by passing it to `#run`.
|
||||||
# This sets up the harness so that the example code can use it.
|
# This sets up the harness so that the example code can use it.
|
||||||
|
@ -9,7 +9,7 @@ module Spectator::Internals
|
||||||
# ```
|
# ```
|
||||||
# Then from the example code, the harness can be accessed via `#current` like so:
|
# Then from the example code, the harness can be accessed via `#current` like so:
|
||||||
# ```
|
# ```
|
||||||
# harness = ::Spectator::Internals::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.
|
|
@ -8,7 +8,7 @@ module Spectator
|
||||||
# and translates to a usable result.
|
# and translates to a usable result.
|
||||||
def run_impl : Result
|
def run_impl : Result
|
||||||
result = capture_result
|
result = capture_result
|
||||||
expectations = Internals::Harness.current.expectations
|
expectations = Harness.current.expectations
|
||||||
translate_result(result, expectations)
|
translate_result(result, expectations)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
require "./internals/harness"
|
require "./harness"
|
||||||
|
|
||||||
module Spectator
|
module Spectator
|
||||||
# Main driver for executing tests and feeding results to formatters.
|
# Main driver for executing tests and feeding results to formatters.
|
||||||
|
@ -59,7 +59,7 @@ module Spectator
|
||||||
result = if @config.dry_run? && example.is_a?(RunnableExample)
|
result = if @config.dry_run? && example.is_a?(RunnableExample)
|
||||||
dry_run_result(example)
|
dry_run_result(example)
|
||||||
else
|
else
|
||||||
Internals::Harness.run(example)
|
Harness.run(example)
|
||||||
end
|
end
|
||||||
@config.each_formatter(&.end_example(result))
|
@config.each_formatter(&.end_example(result))
|
||||||
result
|
result
|
||||||
|
|
Loading…
Reference in a new issue