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.
|
||||
def match(partial)
|
||||
actual = partial.actual
|
||||
MatchData(Expected, typeof(actual)).new(match?(actual), partial.label)
|
||||
MatchData(Expected, typeof(actual)).new(match?(actual), actual, partial.label)
|
||||
end
|
||||
|
||||
# Match data specific to this matcher.
|
||||
private struct MatchData(ExpectedType, ActualType) < MatchData
|
||||
# Creates the match data.
|
||||
def initialize(matched, @actual_label : String)
|
||||
def initialize(matched, @actual : ActualType, @actual_label : String)
|
||||
super(matched)
|
||||
end
|
||||
|
||||
|
@ -33,7 +33,7 @@ module Spectator::Matchers
|
|||
def named_tuple
|
||||
{
|
||||
expected: NegatableMatchDataValue.new(ExpectedType),
|
||||
actual: ActualType,
|
||||
actual: @actual.class,
|
||||
}
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue