abstract class Spectator::Expression(T)

Overview

Represents an expression from a test. This is typically captured by an expect macro. It consists of a label and a typed expression. The label should be a string recognizable by the user, or nil if one isn't available.

Direct Known Subclasses

Defined in:

spectator/expression.cr

Constructors

Instance Method Summary

Instance methods inherited from class Spectator::AbstractExpression

cast(type : T.class) : T forall T cast, inspect(io : IO) : Nil inspect, label : Label label, raw_value raw_value, to_s(io : IO) : Nil to_s

Constructor methods inherited from class Spectator::AbstractExpression

new(label : Label) new

Instance methods inherited from class Object

should(matcher : Spectator::Matchers::TypeMatcher(U), message = nil, *, _file = __FILE__, _line = __LINE__) forall U
should(matcher, message = nil, *, _file = __FILE__, _line = __LINE__)
should
, should_eventually(matcher, message = nil, *, _file = __FILE__, _line = __LINE__) should_eventually, should_never(matcher, message = nil, *, _file = __FILE__, _line = __LINE__) should_never, should_not(matcher : Spectator::Matchers::TypeMatcher(U), message = nil, *, _file = __FILE__, _line = __LINE__) forall U
should_not(matcher : Spectator::Matchers::NilMatcher, message = nil, *, _file = __FILE__, _line = __LINE__)
should_not(matcher, message = nil, *, _file = __FILE__, _line = __LINE__)
should_not

Constructor Detail

def self.new(label : Label) #

Creates the expression. The label is usually the Crystal code evaluating to the #raw_value. It can be nil if it isn't available.


[View source]

Instance Method Detail

def raw_value #

Retrieves the evaluated value of the expression.


[View source]
abstract def value : T #

Retrieves the underlying value of the expression.


[View source]