shard-spectator/src/spectator/expression.cr

19 lines
529 B
Crystal
Raw Normal View History

2021-01-09 07:12:28 +00:00
require "./abstract_expression"
module Spectator
# Represents an expression from a test.
# This is typically captured by an `expect` macro.
# It consists of a label and a typed expression.
2021-01-09 07:12:28 +00:00
# The label should be a string recognizable by the user,
# or nil if one isn't available.
abstract class Expression(T) < AbstractExpression
# Retrieves the underlying value of the expression.
abstract def value : T
2021-01-09 07:12:28 +00:00
# Retrieves the evaluated value of the expression.
def raw_value
value
2021-01-09 07:12:28 +00:00
end
end
end