Show random seed

Only works when a seed specified, not when a random seed is used.
This commit is contained in:
Michael Miller 2020-07-27 12:10:39 -06:00
parent 7aa8cb14a4
commit ba29c1e032
No known key found for this signature in database
GPG key ID: FB9F12F7C646A4AD
2 changed files with 17 additions and 0 deletions

View file

@ -0,0 +1,14 @@
module Spectator::Formatting
# Text displayed when using a random seed.
private struct RandomSeedText
# Creates the text object.
def initialize(@seed : UInt64)
end
# Appends the command to the output.
def to_s(io)
io << "Randomized with seed "
io << @seed
end
end
end

View file

@ -49,6 +49,9 @@ module Spectator::Formatting
private def stats(report)
@io.puts Runtime.new(report.runtime)
@io.puts StatsCounter.new(report).color
if (seed = report.random_seed?)
@io.puts RandomSeedText.new(seed)
end
end
# Produces the skipped tests text if fail-fast is enabled and tests were omitted.