diff --git a/src/spectator/formatting/random_seed_text.cr b/src/spectator/formatting/random_seed_text.cr new file mode 100644 index 0000000..998fed1 --- /dev/null +++ b/src/spectator/formatting/random_seed_text.cr @@ -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 diff --git a/src/spectator/formatting/suite_summary.cr b/src/spectator/formatting/suite_summary.cr index 3d2dcfd..8ff10cf 100644 --- a/src/spectator/formatting/suite_summary.cr +++ b/src/spectator/formatting/suite_summary.cr @@ -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.