mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
a74957204b
Sits between AbstractExpression and Value and Block.
22 lines
689 B
Crystal
22 lines
689 B
Crystal
require "./expression"
|
|
require "./label"
|
|
|
|
module Spectator
|
|
# Represents a value from a test.
|
|
# This is typically captured by an `expect` macro.
|
|
# It consists of a label and the value of the expression.
|
|
# The label should be a string recognizable by the user,
|
|
# or nil if one isn't available.
|
|
class Value(T) < Expression(T)
|
|
# Raw value of the expression.
|
|
getter value : T
|
|
|
|
# Creates the value.
|
|
# Expects the *value* of the expression and a *label* describing it.
|
|
# The *label* is usually the Crystal code evaluating to the *value*.
|
|
# It can be nil if it isn't available.
|
|
def initialize(@value : T, label : Label)
|
|
super(label)
|
|
end
|
|
end
|
|
end
|