mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Allow be
matcher to be used on structs
This commit is contained in:
parent
3d08949c94
commit
60f1c3091b
3 changed files with 11 additions and 5 deletions
|
@ -13,7 +13,13 @@ module Spectator::Matchers
|
|||
|
||||
# Checks whether the matcher is satisifed with the expression given to it.
|
||||
private def match?(actual : TestExpression(T)) : Bool forall T
|
||||
expected.value.same?(actual.value)
|
||||
value = expected.value
|
||||
if value.responds_to?(:same)
|
||||
value.same?(actual.value)
|
||||
else
|
||||
# Value type (struct) comparison.
|
||||
actual.value.class == value.class && actual.value == value
|
||||
end
|
||||
end
|
||||
|
||||
# Message displayed when the matcher isn't satisifed.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue