Fix warnings from Crystal 1.5.0 regarding positional parameters

This commit is contained in:
Michael Miller 2022-07-07 18:10:21 -06:00
parent f7147299ab
commit 70391b2d31
No known key found for this signature in database
GPG key ID: 32B47AE8F388A1FF
5 changed files with 13 additions and 8 deletions

View file

@ -17,7 +17,7 @@ module Spectator::Matchers
# Actually performs the test against the expression.
def match(actual : Expression(T)) : MatchData forall T
snapshot = snapshot_values(actual.value)
if match?(snapshot)
if values_match?(snapshot)
SuccessfulMatchData.new(description)
else
FailedMatchData.new(description, "#{actual.label} does not have #{expected.label}", values(snapshot).to_a)
@ -28,13 +28,18 @@ module Spectator::Matchers
# A successful match with `#match` should normally fail for this method, and vice-versa.
def negated_match(actual : Expression(T)) : MatchData forall T
snapshot = snapshot_values(actual.value)
if match?(snapshot)
if values_match?(snapshot)
FailedMatchData.new(description, "#{actual.label} has #{expected.label}", values(snapshot).to_a)
else
SuccessfulMatchData.new(description)
end
end
def match?(actual : Expression(T)) : Bool forall T
snapshot = snapshot_values(actual.value)
values_match?(snapshot)
end
# Message displayed when the matcher isn't satisfied.
#
# This is only called when `#match?` returns false.
@ -69,7 +74,7 @@ module Spectator::Matchers
end
# Checks if all predicate methods from the snapshot of them are satisfied.
private def match?(snapshot) : Bool
private def values_match?(snapshot) : Bool
# Test each predicate and immediately return false if one is false.
{% for attribute in ExpectedType.keys %}
return false unless snapshot[{{attribute.symbolize}}]

View file

@ -153,7 +153,7 @@ module Spectator
yield
end
private def _spectator_stub_fallback(call : MethodCall, _type, &)
private def _spectator_stub_fallback(call : MethodCall, type, &)
_spectator_stub_fallback(call) { yield }
end
@ -167,7 +167,7 @@ module Spectator
raise UnexpectedMessage.new("#{_spectator_stubbed_name} received unexpected message #{call}")
end
private def _spectator_abstract_stub_fallback(call : MethodCall, _type)
private def _spectator_abstract_stub_fallback(call : MethodCall, type)
_spectator_abstract_stub_fallback(call)
end

View file

@ -5,7 +5,7 @@ module Spectator
# Stub that does nothing and returns nil.
class NullStub < TypedStub(Nil)
# Invokes the stubbed implementation.
def call(_call : MethodCall) : Nil
def call(call : MethodCall) : Nil
end
end
end

View file

@ -7,7 +7,7 @@ module Spectator
# Stub that responds with a static value.
class ValueStub(T) < TypedStub(T)
# Invokes the stubbed implementation.
def call(_call : MethodCall) : T
def call(call : MethodCall) : T
@value
end

View file

@ -9,7 +9,7 @@ module Spectator
end
# Checks whether the node satisfies the filter.
def includes?(_node) : Bool
def includes?(node) : Bool
@match
end
end