mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Output match data to XML
This commit is contained in:
parent
ba3a03736e
commit
dcdb87e31a
1 changed files with 17 additions and 2 deletions
|
@ -62,8 +62,12 @@ module Spectator::Formatting::Components::JUnit
|
|||
# Adds a failure element to the test case node.
|
||||
def fail(result)
|
||||
error = result.error
|
||||
@xml.element("failure", message: error.message, type: error.class) do
|
||||
# TODO: Add match-data as text to node.
|
||||
result.expectations.each do |expectation|
|
||||
next unless expectation.failed?
|
||||
|
||||
@xml.element("failure", message: expectation.failure_message, type: error.class) do
|
||||
match_data(expectation.values)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -81,6 +85,17 @@ module Spectator::Formatting::Components::JUnit
|
|||
def pending(result)
|
||||
@xml.element("skipped", message: result.reason)
|
||||
end
|
||||
|
||||
# Writes match data for a failed expectation.
|
||||
private def match_data(values)
|
||||
values.each do |(key, value)|
|
||||
@xml.text("\n")
|
||||
@xml.text(key.to_s)
|
||||
@xml.text(": ")
|
||||
@xml.text(value)
|
||||
end
|
||||
@xml.text("\n")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue