From 61a3e6b113a46421b21cc6983491302359023864 Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Mon, 28 Jan 2019 10:04:17 -0700 Subject: [PATCH] Remove unecessary type restrictions --- src/spectator/matchers/case_matcher.cr | 6 +++--- src/spectator/matchers/condition_matcher.cr | 6 +++--- src/spectator/matchers/empty_matcher.cr | 6 +++--- src/spectator/matchers/equality_matcher.cr | 6 +++--- src/spectator/matchers/greater_than_equal_matcher.cr | 6 +++--- src/spectator/matchers/greater_than_matcher.cr | 6 +++--- src/spectator/matchers/inequality_matcher.cr | 6 +++--- src/spectator/matchers/less_than_equal_matcher.cr | 6 +++--- src/spectator/matchers/less_than_matcher.cr | 6 +++--- src/spectator/matchers/nil_matcher.cr | 6 +++--- src/spectator/matchers/range_matcher.cr | 6 +++--- src/spectator/matchers/regex_matcher.cr | 6 +++--- src/spectator/matchers/truthy_matcher.cr | 6 +++--- src/spectator/matchers/type_matcher.cr | 6 +++--- src/spectator/matchers/value_matcher.cr | 6 +++--- 15 files changed, 45 insertions(+), 45 deletions(-) diff --git a/src/spectator/matchers/case_matcher.cr b/src/spectator/matchers/case_matcher.cr index 5c3b3a6..842bf3b 100644 --- a/src/spectator/matchers/case_matcher.cr +++ b/src/spectator/matchers/case_matcher.cr @@ -6,19 +6,19 @@ module Spectator::Matchers struct CaseMatcher(ExpectedType) < ValueMatcher(ExpectedType) # Determines whether the matcher is satisfied with the value given to it. # True is returned if the match was successful, false otherwise. - def match?(partial : Expectations::ValueExpectationPartial(ActualType)) : Bool forall ActualType + def match?(partial) : Bool expected === partial.actual end # Describes the condition that satisfies the matcher. # This is informational and displayed to the end-user. - def message(partial : Expectations::ValueExpectationPartial(ActualType)) : String forall ActualType + def message(partial) : String "Expected #{partial.label} to semantically equal #{label} (using ===)" end # Describes the condition that won't satsify the matcher. # This is informational and displayed to the end-user. - def negated_message(partial : Expectations::ValueExpectationPartial(ActualType)) : String forall ActualType + def negated_message(partial) : String "Expected #{partial.label} to not semantically equal #{label} (using ===)" end end diff --git a/src/spectator/matchers/condition_matcher.cr b/src/spectator/matchers/condition_matcher.cr index aa3eab2..bf9d7ba 100644 --- a/src/spectator/matchers/condition_matcher.cr +++ b/src/spectator/matchers/condition_matcher.cr @@ -7,14 +7,14 @@ module Spectator::Matchers abstract struct ConditionMatcher < Matcher # Determines whether the matcher is satisfied with the value given to it. # True is returned if the matcher is satisfied, false otherwise. - abstract def match?(partial : ValueExpectationPartial(ActualType)) : Bool forall ActualType + abstract def match?(partial) : Bool # Describes the condition that satisfies the matcher. # This is informational and displayed to the end-user. - abstract def message(partial : ValueExpectationPartial(ActualType)) : String forall ActualType + abstract def message(partial) : String # Describes the condition that won't satsify the matcher. # This is informational and displayed to the end-user. - abstract def negated_message(partial : ValueExpectationPartial(ActualType)) : String forall ActualType + abstract def negated_message(partial) : String end end diff --git a/src/spectator/matchers/empty_matcher.cr b/src/spectator/matchers/empty_matcher.cr index 888c1f1..655ee24 100644 --- a/src/spectator/matchers/empty_matcher.cr +++ b/src/spectator/matchers/empty_matcher.cr @@ -11,19 +11,19 @@ module Spectator::Matchers # Determines whether the matcher is satisfied with the value given to it. # True is returned if the match was successful, false otherwise. - def match?(partial : Expectations::ValueExpectationPartial(ActualType)) : Bool forall ActualType + def match?(partial) : Bool partial.actual.empty? end # Describes the condition that satisfies the matcher. # This is informational and displayed to the end-user. - def message(partial : Expectations::ValueExpectationPartial(ActualType)) : String forall ActualType + def message(partial) : String "Expected #{partial.label} to be empty" end # Describes the condition that won't satsify the matcher. # This is informational and displayed to the end-user. - def negated_message(partial : Expectations::ValueExpectationPartial(ActualType)) : String forall ActualType + def negated_message(partial) : String "Expected #{partial.label} to not be empty" end end diff --git a/src/spectator/matchers/equality_matcher.cr b/src/spectator/matchers/equality_matcher.cr index d5dd1d3..d5da3f7 100644 --- a/src/spectator/matchers/equality_matcher.cr +++ b/src/spectator/matchers/equality_matcher.cr @@ -6,19 +6,19 @@ module Spectator::Matchers struct EqualityMatcher(ExpectedType) < ValueMatcher(ExpectedType) # Determines whether the matcher is satisfied with the value given to it. # True is returned if the match was successful, false otherwise. - def match?(partial : Expectations::ValueExpectationPartial(ActualType)) : Bool forall ActualType + def match?(partial) : Bool partial.actual == expected end # Describes the condition that satisfies the matcher. # This is informational and displayed to the end-user. - def message(partial : Expectations::ValueExpectationPartial(ActualType)) : String forall ActualType + def message(partial) : String "Expected #{partial.label} to equal #{label} (using ==)" end # Describes the condition that won't satsify the matcher. # This is informational and displayed to the end-user. - def negated_message(partial : Expectations::ValueExpectationPartial(ActualType)) : String forall ActualType + def negated_message(partial) : String "Expected #{partial.label} to not equal #{label} (using ==)" end end diff --git a/src/spectator/matchers/greater_than_equal_matcher.cr b/src/spectator/matchers/greater_than_equal_matcher.cr index f0bdd54..046e13d 100644 --- a/src/spectator/matchers/greater_than_equal_matcher.cr +++ b/src/spectator/matchers/greater_than_equal_matcher.cr @@ -6,19 +6,19 @@ module Spectator::Matchers struct GreaterThanEqualMatcher(ExpectedType) < ValueMatcher(ExpectedType) # Determines whether the matcher is satisfied with the value given to it. # True is returned if the match was successful, false otherwise. - def match?(partial : Expectations::ValueExpectationPartial(ActualType)) : Bool forall ActualType + def match?(partial) : Bool partial.actual >= expected end # Describes the condition that satisfies the matcher. # This is informational and displayed to the end-user. - def message(partial : Expectations::ValueExpectationPartial(ActualType)) : String forall ActualType + def message(partial) : String "Expected #{partial.label} to be greater than or equal to #{label} (using >=)" end # Describes the condition that won't satsify the matcher. # This is informational and displayed to the end-user. - def negated_message(partial : Expectations::ValueExpectationPartial(ActualType)) : String forall ActualType + def negated_message(partial) : String "Expected #{partial.label} to not be greater than or equal to #{label} (using >=)" end end diff --git a/src/spectator/matchers/greater_than_matcher.cr b/src/spectator/matchers/greater_than_matcher.cr index 6d72ca9..538cbe6 100644 --- a/src/spectator/matchers/greater_than_matcher.cr +++ b/src/spectator/matchers/greater_than_matcher.cr @@ -6,19 +6,19 @@ module Spectator::Matchers struct GreaterThanMatcher(ExpectedType) < ValueMatcher(ExpectedType) # Determines whether the matcher is satisfied with the value given to it. # True is returned if the match was successful, false otherwise. - def match?(partial : Expectations::ValueExpectationPartial(ActualType)) : Bool forall ActualType + def match?(partial) : Bool partial.actual > expected end # Describes the condition that satisfies the matcher. # This is informational and displayed to the end-user. - def message(partial : Expectations::ValueExpectationPartial(ActualType)) : String forall ActualType + def message(partial) : String "Expected #{partial.label} to be greater than #{label} (using >)" end # Describes the condition that won't satsify the matcher. # This is informational and displayed to the end-user. - def negated_message(partial : Expectations::ValueExpectationPartial(ActualType)) : String forall ActualType + def negated_message(partial) : String "Expected #{partial.label} to not be greater than #{label} (using >)" end end diff --git a/src/spectator/matchers/inequality_matcher.cr b/src/spectator/matchers/inequality_matcher.cr index c04d46d..f17319b 100644 --- a/src/spectator/matchers/inequality_matcher.cr +++ b/src/spectator/matchers/inequality_matcher.cr @@ -6,19 +6,19 @@ module Spectator::Matchers struct InequalityMatcher(ExpectedType) < ValueMatcher(ExpectedType) # Determines whether the matcher is satisfied with the value given to it. # True is returned if the match was successful, false otherwise. - def match?(partial : Expectations::ValueExpectationPartial(ActualType)) : Bool forall ActualType + def match?(partial) : Bool partial.actual != expected end # Describes the condition that satisfies the matcher. # This is informational and displayed to the end-user. - def message(partial : Expectations::ValueExpectationPartial(ActualType)) : String forall ActualType + def message(partial) : String "Expected #{partial.label} to not equal #{label} (using !=)" end # Describes the condition that won't satsify the matcher. # This is informational and displayed to the end-user. - def negated_message(partial : Expectations::ValueExpectationPartial(ActualType)) : String forall ActualType + def negated_message(partial) : String "Expected #{partial.label} to equal #{label} (using !=)" end end diff --git a/src/spectator/matchers/less_than_equal_matcher.cr b/src/spectator/matchers/less_than_equal_matcher.cr index 8df1d8b..a399088 100644 --- a/src/spectator/matchers/less_than_equal_matcher.cr +++ b/src/spectator/matchers/less_than_equal_matcher.cr @@ -6,19 +6,19 @@ module Spectator::Matchers struct LessThanEqualMatcher(ExpectedType) < ValueMatcher(ExpectedType) # Determines whether the matcher is satisfied with the value given to it. # True is returned if the match was successful, false otherwise. - def match?(partial : Expectations::ValueExpectationPartial(ActualType)) : Bool forall ActualType + def match?(partial) : Bool partial.actual <= expected end # Describes the condition that satisfies the matcher. # This is informational and displayed to the end-user. - def message(partial : Expectations::ValueExpectationPartial(ActualType)) : String forall ActualType + def message(partial) : String "Expected #{partial.label} to be less than or equal to #{label} (using <=)" end # Describes the condition that won't satsify the matcher. # This is informational and displayed to the end-user. - def negated_message(partial : Expectations::ValueExpectationPartial(ActualType)) : String forall ActualType + def negated_message(partial) : String "Expected #{partial.label} to not be less than or equal to #{label} (using <=)" end end diff --git a/src/spectator/matchers/less_than_matcher.cr b/src/spectator/matchers/less_than_matcher.cr index 363b564..b82a50a 100644 --- a/src/spectator/matchers/less_than_matcher.cr +++ b/src/spectator/matchers/less_than_matcher.cr @@ -6,19 +6,19 @@ module Spectator::Matchers struct LessThanMatcher(ExpectedType) < ValueMatcher(ExpectedType) # Determines whether the matcher is satisfied with the value given to it. # True is returned if the match was successful, false otherwise. - def match?(partial : Expectations::ValueExpectationPartial(ActualType)) : Bool forall ActualType + def match?(partial) : Bool partial.actual < expected end # Describes the condition that satisfies the matcher. # This is informational and displayed to the end-user. - def message(partial : Expectations::ValueExpectationPartial(ActualType)) : String forall ActualType + def message(partial) : String "Expected #{partial.label} to be less than #{label} (using <)" end # Describes the condition that won't satsify the matcher. # This is informational and displayed to the end-user. - def negated_message(partial : Expectations::ValueExpectationPartial(ActualType)) : String forall ActualType + def negated_message(partial) : String "Expected #{partial.label} to not be less than #{label} (using <)" end end diff --git a/src/spectator/matchers/nil_matcher.cr b/src/spectator/matchers/nil_matcher.cr index b8b0da3..f524898 100644 --- a/src/spectator/matchers/nil_matcher.cr +++ b/src/spectator/matchers/nil_matcher.cr @@ -11,19 +11,19 @@ module Spectator::Matchers # Determines whether the matcher is satisfied with the value given to it. # True is returned if the match was successful, false otherwise. - def match?(partial : Expectations::ValueExpectationPartial(ActualType)) : Bool forall ActualType + def match?(partial) : Bool partial.actual.nil? end # Describes the condition that satisfies the matcher. # This is informational and displayed to the end-user. - def message(partial : Expectations::ValueExpectationPartial(ActualType)) : String forall ActualType + def message(partial) : String "Expected #{partial.label} to be nil" end # Describes the condition that won't satsify the matcher. # This is informational and displayed to the end-user. - def negated_message(partial : Expectations::ValueExpectationPartial(ActualType)) : String forall ActualType + def negated_message(partial) : String "Expected #{partial.label} to not be nil" end end diff --git a/src/spectator/matchers/range_matcher.cr b/src/spectator/matchers/range_matcher.cr index b7ed49a..5a28dc5 100644 --- a/src/spectator/matchers/range_matcher.cr +++ b/src/spectator/matchers/range_matcher.cr @@ -8,19 +8,19 @@ module Spectator::Matchers struct RangeMatcher(ExpectedType) < ValueMatcher(ExpectedType) # Determines whether the matcher is satisfied with the value given to it. # True is returned if the match was successful, false otherwise. - def match?(partial : Expectations::ValueExpectationPartial(ActualType)) : Bool forall ActualType + def match?(partial) : Bool @expected.includes?(partial.actual) end # Describes the condition that satisfies the matcher. # This is informational and displayed to the end-user. - def message(partial : Expectations::ValueExpectationPartial(ActualType)) : String forall ActualType + def message(partial) : String "Expected #{partial.label} to be in #{label}" end # Describes the condition that won't satsify the matcher. # This is informational and displayed to the end-user. - def negated_message(partial : Expectations::ValueExpectationPartial(ActualType)) : String forall ActualType + def negated_message(partial) : String "Expected #{partial.label} to not be in #{label}" end diff --git a/src/spectator/matchers/regex_matcher.cr b/src/spectator/matchers/regex_matcher.cr index eca5192..80d4fdf 100644 --- a/src/spectator/matchers/regex_matcher.cr +++ b/src/spectator/matchers/regex_matcher.cr @@ -6,19 +6,19 @@ module Spectator::Matchers struct RegexMatcher(ExpectedType) < ValueMatcher(ExpectedType) # Determines whether the matcher is satisfied with the value given to it. # True is returned if the match was successful, false otherwise. - def match?(partial : Expectations::ValueExpectationPartial(ActualType)) : Bool forall ActualType + def match?(partial) : Bool !!(partial.actual =~ expected) end # Describes the condition that satisfies the matcher. # This is informational and displayed to the end-user. - def message(partial : Expectations::ValueExpectationPartial(ActualType)) : String forall ActualType + def message(partial) : String "Expected #{partial.label} to match #{label} (using =~)" end # Describes the condition that won't satsify the matcher. # This is informational and displayed to the end-user. - def negated_message(partial : Expectations::ValueExpectationPartial(ActualType)) : String forall ActualType + def negated_message(partial) : String "Expected #{partial.label} to not match #{label} (using =~)" end end diff --git a/src/spectator/matchers/truthy_matcher.cr b/src/spectator/matchers/truthy_matcher.cr index 79d9308..f7c8444 100644 --- a/src/spectator/matchers/truthy_matcher.cr +++ b/src/spectator/matchers/truthy_matcher.cr @@ -18,20 +18,20 @@ module Spectator::Matchers # Determines whether the matcher is satisfied with the value given to it. # True is returned if the match was successful, false otherwise. - def match?(partial : Expectations::ValueExpectationPartial(ActualType)) : Bool forall ActualType + def match?(partial) : Bool # Cast value to truthy value and compare. @expected == !!partial.actual end # Describes the condition that satisfies the matcher. # This is informational and displayed to the end-user. - def message(partial : Expectations::ValueExpectationPartial(ActualType)) : String forall ActualType + def message(partial) : String "Expected #{partial.label} to be #{label}" end # Describes the condition that won't satsify the matcher. # This is informational and displayed to the end-user. - def negated_message(partial : Expectations::ValueExpectationPartial(ActualType)) : String forall ActualType + def negated_message(partial) : String "Expected #{partial.label} to not be #{label}" end diff --git a/src/spectator/matchers/type_matcher.cr b/src/spectator/matchers/type_matcher.cr index e762ba7..0a82321 100644 --- a/src/spectator/matchers/type_matcher.cr +++ b/src/spectator/matchers/type_matcher.cr @@ -12,19 +12,19 @@ module Spectator::Matchers # Determines whether the matcher is satisfied with the value given to it. # True is returned if the match was successful, false otherwise. - def match?(partial : Expectations::ValueExpectationPartial(ActualType)) : Bool forall ActualType + def match?(partial) : Bool partial.actual.is_a?(Expected) end # Describes the condition that satisfies the matcher. # This is informational and displayed to the end-user. - def message(partial : Expectations::ValueExpectationPartial(ActualType)) : String forall ActualType + def message(partial) : String "Expected #{partial.label} to be a #{label}" end # Describes the condition that won't satsify the matcher. # This is informational and displayed to the end-user. - def negated_message(partial : Expectations::ValueExpectationPartial(ActualType)) : String forall ActualType + def negated_message(partial) : String "Expected #{partial.label} to not be a #{label}" end end diff --git a/src/spectator/matchers/value_matcher.cr b/src/spectator/matchers/value_matcher.cr index f1c8785..aab946c 100644 --- a/src/spectator/matchers/value_matcher.cr +++ b/src/spectator/matchers/value_matcher.cr @@ -26,14 +26,14 @@ module Spectator::Matchers # Determines whether the matcher is satisfied with the value given to it. # True is returned if the matcher is satisfied, false otherwise. - abstract def match?(partial : ValueExpectationPartial(ActualType)) : Bool forall ActualType + abstract def match?(partial) : Bool # Describes the condition that satisfies the matcher. # This is informational and displayed to the end-user. - abstract def message(partial : ValueExpectationPartial(ActualType)) : String forall ActualType + abstract def message(partial) : String # Describes the condition that won't satsify the matcher. # This is informational and displayed to the end-user. - abstract def negated_message(partial : ValueExpectationPartial(ActualType)) : String forall ActualType + abstract def negated_message(partial) : String end end