MatchDataValue must be a class

Negatable value modifiers don't get updated when they're structs.
This commit is contained in:
Michael Miller 2019-03-22 11:01:47 -06:00
parent a19d9f00aa
commit 5e80b3835a
6 changed files with 6 additions and 6 deletions

View file

@ -3,7 +3,7 @@ require "./match_data_value"
module Spectator::Matchers
# Selects a value based on whether the value is negated.
# This is used when a matcher is negated.
private struct AlternativeMatchDataValue(T1, T2) < MatchDataValue
private class AlternativeMatchDataValue(T1, T2) < MatchDataValue
# Creates the wrapper.
def initialize(@value1 : T1, @value2 : T2)
@negated = false

View file

@ -2,7 +2,7 @@ require "./match_data_value"
module Spectator::Matchers
# Wraps a value for used in match data.
private struct GenericMatchDataValue(T) < MatchDataValue
private class GenericMatchDataValue(T) < MatchDataValue
# Creates the wrapper.
def initialize(@value : T)
end

View file

@ -1,6 +1,6 @@
module Spectator::Matchers
# Abstract base for all match data values.
# All sub-classes are expected to implement their own `#to_s`.
private abstract struct MatchDataValue
private abstract class MatchDataValue
end
end

View file

@ -3,7 +3,7 @@ require "./match_data_value"
module Spectator::Matchers
# Wraps an expected value that can be negated.
# This is used when a matcher is negated.
private struct NegatableMatchDataValue(T) < MatchDataValue
private class NegatableMatchDataValue(T) < MatchDataValue
# Negatable value.
getter value

View file

@ -3,7 +3,7 @@ require "./match_data_value"
module Spectator::Matchers
# Wraps a prefixed value that can be negated.
# This is used when a matcher is negated.
private struct NegatablePrefixedMatchDataValue(T) < MatchDataValue
private class NegatablePrefixedMatchDataValue(T) < MatchDataValue
# Negatable value.
getter value

View file

@ -2,7 +2,7 @@ require "./match_data_value"
module Spectator::Matchers
# Prefixes (for output formatting) an actual or expected value.
private struct PrefixedMatchDataValue(T) < MatchDataValue
private class PrefixedMatchDataValue(T) < MatchDataValue
# Value being prefixed.
getter value : T