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.
|
2021-01-16 05:32:02 +00:00
|
|
|
# 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.
|
2021-01-16 05:32:02 +00:00
|
|
|
abstract class Expression(T) < AbstractExpression
|
|
|
|
# Retrieves the underlying value of the expression.
|
|
|
|
abstract def value : T
|
2021-01-09 07:12:28 +00:00
|
|
|
|
2021-01-16 05:32:02 +00:00
|
|
|
# Retrieves the evaluated value of the expression.
|
|
|
|
def raw_value
|
|
|
|
value
|
2021-01-09 07:12:28 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|