shard-spectator/src/spectator/result.cr

21 lines
672 B
Crystal
Raw Normal View History

2018-08-31 03:07:14 +00:00
module Spectator
2018-11-16 16:48:35 +00:00
# Base class that represents the outcome of running an example.
# Sub-classes contain additional information specific to the type of result.
2018-09-15 19:25:11 +00:00
abstract class Result
2020-10-17 20:56:31 +00:00
# Length of time it took to run the example.
getter elapsed : Time::Span
2018-11-16 16:48:35 +00:00
2020-10-17 20:56:31 +00:00
# The assertions checked in the example.
# getter assertions : Enumerable(Assertion) # TODO: Implement Assertion type.
2019-02-21 04:00:22 +00:00
2020-10-17 20:56:31 +00:00
# Creates the result.
# *elapsed* is the length of time it took to run the example.
def initialize(@elapsed)
end
2020-10-17 20:56:31 +00:00
# Calls the corresponding method for the type of result.
# This is the visitor design pattern.
abstract def accept(visitor)
2018-08-31 03:07:14 +00:00
end
end