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
|
end
|
||||||
|
|
||||||
@deferred = Deque(->).new
|
@deferred = Deque(->).new
|
||||||
|
@expectations = [] of Expectation
|
||||||
|
|
||||||
# Runs test code and produces a result based on the outcome.
|
# 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.
|
# 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
|
def report(expectation : Expectation) : Nil
|
||||||
Log.debug { "Reporting expectation #{expectation}" }
|
Log.debug { "Reporting expectation #{expectation}" }
|
||||||
|
@expectations << expectation
|
||||||
raise ExpectationFailed.new(expectation) if expectation.failed?
|
raise ExpectationFailed.new(expectation) if expectation.failed?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -94,11 +96,11 @@ module Spectator
|
||||||
example = Example.current # TODO: Remove this.
|
example = Example.current # TODO: Remove this.
|
||||||
case error
|
case error
|
||||||
when nil
|
when nil
|
||||||
PassResult.new(example, elapsed)
|
PassResult.new(example, elapsed, @expectations)
|
||||||
when ExpectationFailed
|
when ExpectationFailed
|
||||||
FailResult.new(example, elapsed, error)
|
FailResult.new(example, elapsed, error, @expectations)
|
||||||
else
|
else
|
||||||
ErrorResult.new(example, elapsed, error)
|
ErrorResult.new(example, elapsed, error, @expectations)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue