mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Fix the actual type reported by the type matcher
If an object has a difference between compiler and runtime type, then the type matcher would report the actual as the compiler type. The match would be successful, because it uses the runtime check (is_a?).
This commit is contained in:
parent
b6ac736dd2
commit
cc4ab9756a
1 changed files with 3 additions and 3 deletions
|
@ -19,13 +19,13 @@ module Spectator::Matchers
|
||||||
# `MatchData` is returned that contains information about the match.
|
# `MatchData` is returned that contains information about the match.
|
||||||
def match(partial)
|
def match(partial)
|
||||||
actual = partial.actual
|
actual = partial.actual
|
||||||
MatchData(Expected, typeof(actual)).new(match?(actual), partial.label)
|
MatchData(Expected, typeof(actual)).new(match?(actual), actual, partial.label)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Match data specific to this matcher.
|
# Match data specific to this matcher.
|
||||||
private struct MatchData(ExpectedType, ActualType) < MatchData
|
private struct MatchData(ExpectedType, ActualType) < MatchData
|
||||||
# Creates the match data.
|
# Creates the match data.
|
||||||
def initialize(matched, @actual_label : String)
|
def initialize(matched, @actual : ActualType, @actual_label : String)
|
||||||
super(matched)
|
super(matched)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ module Spectator::Matchers
|
||||||
def named_tuple
|
def named_tuple
|
||||||
{
|
{
|
||||||
expected: NegatableMatchDataValue.new(ExpectedType),
|
expected: NegatableMatchDataValue.new(ExpectedType),
|
||||||
actual: ActualType,
|
actual: @actual.class,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue