mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Capture reported expectations
This commit is contained in:
parent
bda554739c
commit
9743f37e5c
1 changed files with 5 additions and 3 deletions
|
@ -53,6 +53,7 @@ module Spectator
|
|||
end
|
||||
|
||||
@deferred = Deque(->).new
|
||||
@expectations = [] of Expectation
|
||||
|
||||
# Runs test code and produces a result based on the outcome.
|
||||
# The test code should be called from within the block given to this method.
|
||||
|
@ -64,6 +65,7 @@ module Spectator
|
|||
|
||||
def report(expectation : Expectation) : Nil
|
||||
Log.debug { "Reporting expectation #{expectation}" }
|
||||
@expectations << expectation
|
||||
raise ExpectationFailed.new(expectation) if expectation.failed?
|
||||
end
|
||||
|
||||
|
@ -94,11 +96,11 @@ module Spectator
|
|||
example = Example.current # TODO: Remove this.
|
||||
case error
|
||||
when nil
|
||||
PassResult.new(example, elapsed)
|
||||
PassResult.new(example, elapsed, @expectations)
|
||||
when ExpectationFailed
|
||||
FailResult.new(example, elapsed, error)
|
||||
FailResult.new(example, elapsed, error, @expectations)
|
||||
else
|
||||
ErrorResult.new(example, elapsed, error)
|
||||
ErrorResult.new(example, elapsed, error, @expectations)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue