From d64ecc41924e6a9011de03b9f87541842b3f99cd Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Thu, 2 Jan 2020 19:16:33 -0700 Subject: [PATCH] Store matcher description in MatchData --- src/spectator/matchers/all_matcher.cr | 2 +- src/spectator/matchers/array_matcher.cr | 12 +++++------ src/spectator/matchers/attributes_matcher.cr | 8 ++++---- .../matchers/change_exact_matcher.cr | 14 ++++++------- src/spectator/matchers/change_from_matcher.cr | 12 +++++------ src/spectator/matchers/change_matcher.cr | 8 ++++---- .../matchers/change_relative_matcher.cr | 6 +++--- src/spectator/matchers/change_to_matcher.cr | 6 +++--- src/spectator/matchers/end_with_matcher.cr | 16 +++++++-------- src/spectator/matchers/exception_matcher.cr | 20 +++++++++---------- src/spectator/matchers/failed_match_data.cr | 6 ++++-- src/spectator/matchers/match_data.cr | 5 +++++ src/spectator/matchers/predicate_matcher.cr | 8 ++++---- src/spectator/matchers/respond_matcher.cr | 8 ++++---- src/spectator/matchers/standard_matcher.cr | 9 +++++---- src/spectator/matchers/start_with_matcher.cr | 16 +++++++-------- .../matchers/unordered_array_matcher.cr | 8 ++++---- 17 files changed, 86 insertions(+), 78 deletions(-) diff --git a/src/spectator/matchers/all_matcher.cr b/src/spectator/matchers/all_matcher.cr index bf6231d..d99ade4 100644 --- a/src/spectator/matchers/all_matcher.cr +++ b/src/spectator/matchers/all_matcher.cr @@ -26,7 +26,7 @@ module Spectator::Matchers match_data = matcher.match(element) break match_data unless match_data.matched? end - found || SuccessfulMatchData.new + found || SuccessfulMatchData.new(description) end # Negated matching for this matcher is not supported. diff --git a/src/spectator/matchers/array_matcher.cr b/src/spectator/matchers/array_matcher.cr index 314a31e..8144db5 100644 --- a/src/spectator/matchers/array_matcher.cr +++ b/src/spectator/matchers/array_matcher.cr @@ -31,7 +31,7 @@ module Spectator::Matchers when Int # Content differs. failed_content_mismatch(expected_elements, actual_elements, index, actual.label) when true # Contents are identical. - SuccessfulMatchData.new + SuccessfulMatchData.new(description) else # Size differs. failed_size_mismatch(expected_elements, actual_elements, actual.label) end @@ -45,11 +45,11 @@ module Spectator::Matchers case compare_arrays(expected_elements, actual_elements) when Int # Contents differ. - SuccessfulMatchData.new + SuccessfulMatchData.new(description) when true # Contents are identical. failed_content_identical(expected_elements, actual_elements, actual.label) else # Size differs. - SuccessfulMatchData.new + SuccessfulMatchData.new(description) end end @@ -85,7 +85,7 @@ module Spectator::Matchers # Produces match data for a failure when the array sizes differ. private def failed_size_mismatch(expected_elements, actual_elements, actual_label) - FailedMatchData.new("#{actual_label} does not contain exactly #{expected.label} (size mismatch)", + FailedMatchData.new(description, "#{actual_label} does not contain exactly #{expected.label} (size mismatch)", expected: expected_elements.inspect, actual: actual_elements.inspect, "expected size": expected_elements.size.to_s, @@ -95,7 +95,7 @@ module Spectator::Matchers # Produces match data for a failure when the array content is mismatched. private def failed_content_mismatch(expected_elements, actual_elements, index, actual_label) - FailedMatchData.new("#{actual_label} does not contain exactly #{expected.label} (element mismatch)", + FailedMatchData.new(description, "#{actual_label} does not contain exactly #{expected.label} (element mismatch)", expected: expected_elements[index].inspect, actual: actual_elements[index].inspect, index: index.to_s @@ -104,7 +104,7 @@ module Spectator::Matchers # Produces match data for a failure when the arrays are identical, but they shouldn't be (negation). private def failed_content_identical(expected_elements, actual_elements, actual_label) - FailedMatchData.new("#{actual_label} contains exactly #{expected.label}", + FailedMatchData.new(description, "#{actual_label} contains exactly #{expected.label}", expected: "Not #{expected_elements.inspect}", actual: actual_elements.inspect ) diff --git a/src/spectator/matchers/attributes_matcher.cr b/src/spectator/matchers/attributes_matcher.cr index 93cd62a..2a72d5b 100644 --- a/src/spectator/matchers/attributes_matcher.cr +++ b/src/spectator/matchers/attributes_matcher.cr @@ -28,9 +28,9 @@ module Spectator::Matchers def match(actual : TestExpression(T)) : MatchData forall T snapshot = snapshot_values(actual.value) if match?(snapshot) - SuccessfulMatchData.new + SuccessfulMatchData.new(description) else - FailedMatchData.new("#{actual.label} does not have attributes #{expected.label}", **values(snapshot)) + FailedMatchData.new(description, "#{actual.label} does not have attributes #{expected.label}", **values(snapshot)) end end @@ -39,9 +39,9 @@ module Spectator::Matchers def negated_match(actual : TestExpression(T)) : MatchData forall T snapshot = snapshot_values(actual.value) if match?(snapshot) - FailedMatchData.new("#{actual.label} has attributes #{expected.label}", **negated_values(snapshot)) + FailedMatchData.new(description, "#{actual.label} has attributes #{expected.label}", **negated_values(snapshot)) else - SuccessfulMatchData.new + SuccessfulMatchData.new(description) end end diff --git a/src/spectator/matchers/change_exact_matcher.cr b/src/spectator/matchers/change_exact_matcher.cr index 7245386..6aa562d 100644 --- a/src/spectator/matchers/change_exact_matcher.cr +++ b/src/spectator/matchers/change_exact_matcher.cr @@ -30,21 +30,21 @@ module Spectator::Matchers before, after = change(actual) if expected_before == before if before == after - FailedMatchData.new("#{actual.label} did not change #{expression.label}", + FailedMatchData.new(description, "#{actual.label} did not change #{expression.label}", before: before.inspect, after: after.inspect ) elsif expected_after == after - SuccessfulMatchData.new + SuccessfulMatchData.new(description) else - FailedMatchData.new("#{actual.label} did not change #{expression.label} to #{expected_after.inspect}", + FailedMatchData.new(description, "#{actual.label} did not change #{expression.label} to #{expected_after.inspect}", before: before.inspect, after: after.inspect, expected: expected_after.inspect ) end else - FailedMatchData.new("#{expression.label} was not initially #{expected_before.inspect}", + FailedMatchData.new(description, "#{expression.label} was not initially #{expected_before.inspect}", expected: expected_before.inspect, actual: before.inspect, ) @@ -57,15 +57,15 @@ module Spectator::Matchers before, after = change(actual) if expected_before == before if expected_after == after - FailedMatchData.new("#{actual.label} changed #{expression.label} from #{expected_before.inspect} to #{expected_after.inspect}", + FailedMatchData.new(description, "#{actual.label} changed #{expression.label} from #{expected_before.inspect} to #{expected_after.inspect}", before: before.inspect, after: after.inspect ) else - SuccessfulMatchData.new + SuccessfulMatchData.new(description) end else - FailedMatchData.new("#{expression.label} was not initially #{expected_before.inspect}", + FailedMatchData.new(description, "#{expression.label} was not initially #{expected_before.inspect}", expected: expected_before.inspect, actual: before.inspect, ) diff --git a/src/spectator/matchers/change_from_matcher.cr b/src/spectator/matchers/change_from_matcher.cr index fa3504b..c0e08c1 100644 --- a/src/spectator/matchers/change_from_matcher.cr +++ b/src/spectator/matchers/change_from_matcher.cr @@ -27,18 +27,18 @@ module Spectator::Matchers def match(actual : TestExpression(T)) : MatchData forall T before, after = change(actual) if expected != before - FailedMatchData.new("#{expression.label} was not initially #{expected}", + FailedMatchData.new(description, "#{expression.label} was not initially #{expected}", expected: expected.inspect, actual: before.inspect, ) elsif before == after - FailedMatchData.new("#{actual.label} did not change #{expression.label} from #{expected}", + FailedMatchData.new(description, "#{actual.label} did not change #{expression.label} from #{expected}", before: before.inspect, after: after.inspect, expected: "Not #{expected.inspect}" ) else - SuccessfulMatchData.new + SuccessfulMatchData.new(description) end end @@ -47,14 +47,14 @@ module Spectator::Matchers def negated_match(actual : TestExpression(T)) : MatchData forall T before, after = change(actual) if expected != before - FailedMatchData.new("#{expression.label} was not initially #{expected}", + FailedMatchData.new(description, "#{expression.label} was not initially #{expected}", expected: expected.inspect, actual: before.inspect ) elsif before == after - SuccessfulMatchData.new + SuccessfulMatchData.new(description) else - FailedMatchData.new("#{actual.label} changed #{expression.label} from #{expected}", + FailedMatchData.new(description, "#{actual.label} changed #{expression.label} from #{expected}", before: before.inspect, after: after.inspect, expected: expected.inspect diff --git a/src/spectator/matchers/change_matcher.cr b/src/spectator/matchers/change_matcher.cr index 5de2415..a60891b 100644 --- a/src/spectator/matchers/change_matcher.cr +++ b/src/spectator/matchers/change_matcher.cr @@ -25,12 +25,12 @@ module Spectator::Matchers def match(actual : TestExpression(T)) : MatchData forall T before, after = change(actual) if before == after - FailedMatchData.new("#{actual.label} did not change #{expression.label}", + FailedMatchData.new(description, "#{actual.label} did not change #{expression.label}", before: before.inspect, after: after.inspect ) else - SuccessfulMatchData.new + SuccessfulMatchData.new(description) end end @@ -39,9 +39,9 @@ module Spectator::Matchers def negated_match(actual : TestExpression(T)) : MatchData forall T before, after = change(actual) if before == after - SuccessfulMatchData.new + SuccessfulMatchData.new(description) else - FailedMatchData.new("#{actual.label} changed #{expression.label}", + FailedMatchData.new(description, "#{actual.label} changed #{expression.label}", before: before.inspect, after: after.inspect ) diff --git a/src/spectator/matchers/change_relative_matcher.cr b/src/spectator/matchers/change_relative_matcher.cr index 2f170eb..4ac6e38 100644 --- a/src/spectator/matchers/change_relative_matcher.cr +++ b/src/spectator/matchers/change_relative_matcher.cr @@ -25,14 +25,14 @@ module Spectator::Matchers def match(actual : TestExpression(T)) : MatchData forall T before, after = change(actual) if before == after - FailedMatchData.new("#{actual.label} did not change #{expression.label}", + FailedMatchData.new(description, "#{actual.label} did not change #{expression.label}", before: before.inspect, after: after.inspect ) elsif @evaluator.call(before, after) - SuccessfulMatchData.new + SuccessfulMatchData.new(description) else - FailedMatchData.new("#{actual.label} did not change #{expression.label} #{@relativity}", + FailedMatchData.new(description, "#{actual.label} did not change #{expression.label} #{@relativity}", before: before.inspect, after: after.inspect ) diff --git a/src/spectator/matchers/change_to_matcher.cr b/src/spectator/matchers/change_to_matcher.cr index e29d23b..fb43204 100644 --- a/src/spectator/matchers/change_to_matcher.cr +++ b/src/spectator/matchers/change_to_matcher.cr @@ -27,15 +27,15 @@ module Spectator::Matchers def match(actual : TestExpression(T)) : MatchData forall T before, after = change(actual) if before == after - FailedMatchData.new("#{actual.label} did not change #{expression.label}", + FailedMatchData.new(description, "#{actual.label} did not change #{expression.label}", before: before.inspect, after: after.inspect, expected: expected.inspect ) elsif expected == after - SuccessfulMatchData.new + SuccessfulMatchData.new(description) else - FailedMatchData.new("#{actual.label} did not change #{expression.label} to #{expected}", + FailedMatchData.new(description, "#{actual.label} did not change #{expression.label} to #{expected}", before: before.inspect, after: after.inspect, expected: expected.inspect diff --git a/src/spectator/matchers/end_with_matcher.cr b/src/spectator/matchers/end_with_matcher.cr index cc28e9a..4d77a36 100644 --- a/src/spectator/matchers/end_with_matcher.cr +++ b/src/spectator/matchers/end_with_matcher.cr @@ -44,9 +44,9 @@ module Spectator::Matchers # This method expects (and uses) the `#ends_with?` method on the value. private def match_ends_with(actual_value, actual_label) if actual_value.ends_with?(expected.value) - SuccessfulMatchData.new + SuccessfulMatchData.new(description) else - FailedMatchData.new("#{actual_label} does not end with #{expected.label} (using #ends_with?)", + FailedMatchData.new(description, "#{actual_label} does not end with #{expected.label} (using #ends_with?)", expected: expected.value.inspect, actual: actual_value.inspect ) @@ -60,9 +60,9 @@ module Spectator::Matchers last = list.last if expected.value === last - SuccessfulMatchData.new + SuccessfulMatchData.new(description) else - FailedMatchData.new("#{actual_label} does not end with #{expected.label} (using expected === last)", + FailedMatchData.new(description, "#{actual_label} does not end with #{expected.label} (using expected === last)", expected: expected.value.inspect, actual: last.inspect, list: list.inspect @@ -74,12 +74,12 @@ module Spectator::Matchers # This method expects (and uses) the `#ends_with?` method on the value. private def negated_match_ends_with(actual) if actual.value.ends_with?(expected.value) - FailedMatchData.new("#{actual.label} ends with #{expected.label} (using #ends_with?)", + FailedMatchData.new(description, "#{actual.label} ends with #{expected.label} (using #ends_with?)", expected: expected.value.inspect, actual: actual.value.inspect ) else - SuccessfulMatchData.new + SuccessfulMatchData.new(description) end end @@ -90,13 +90,13 @@ module Spectator::Matchers last = list.last if expected.value === last - FailedMatchData.new("#{actual.label} ends with #{expected.label} (using expected === last)", + FailedMatchData.new(description, "#{actual.label} ends with #{expected.label} (using expected === last)", expected: expected.value.inspect, actual: last.inspect, list: list.inspect ) else - SuccessfulMatchData.new + SuccessfulMatchData.new(description) end end end diff --git a/src/spectator/matchers/exception_matcher.cr b/src/spectator/matchers/exception_matcher.cr index 6455df5..f94c3f2 100644 --- a/src/spectator/matchers/exception_matcher.cr +++ b/src/spectator/matchers/exception_matcher.cr @@ -33,16 +33,16 @@ module Spectator::Matchers def match(actual : TestExpression(T)) : MatchData forall T exception = capture_exception { actual.value } if exception.nil? - FailedMatchData.new("#{actual.label} did not raise", expected: ExceptionType.inspect) + FailedMatchData.new(description, "#{actual.label} did not raise", expected: ExceptionType.inspect) else if exception.is_a?(ExceptionType) if (value = expected.value).nil? - SuccessfulMatchData.new + SuccessfulMatchData.new(description) else if value === exception.message - SuccessfulMatchData.new + SuccessfulMatchData.new(description) else - FailedMatchData.new("#{actual.label} raised #{exception.class}, but the message is not #{expected.label}", + FailedMatchData.new(description, "#{actual.label} raised #{exception.class}, but the message is not #{expected.label}", "expected type": ExceptionType.inspect, "actual type": exception.class.inspect, "expected message": value.inspect, @@ -51,7 +51,7 @@ module Spectator::Matchers end end else - FailedMatchData.new("#{actual.label} did not raise #{ExceptionType}", + FailedMatchData.new(description, "#{actual.label} did not raise #{ExceptionType}", expected: ExceptionType.inspect, actual: exception.class.inspect ) @@ -64,28 +64,28 @@ module Spectator::Matchers def negated_match(actual : TestExpression(T)) : MatchData forall T exception = capture_exception { actual.value } if exception.nil? - SuccessfulMatchData.new + SuccessfulMatchData.new(description) else if exception.is_a?(ExceptionType) if (value = expected.value).nil? - FailedMatchData.new("#{actual.label} raised #{exception.class}", + FailedMatchData.new(description, "#{actual.label} raised #{exception.class}", expected: "Not #{ExceptionType}", actual: exception.class.inspect ) else if value === exception.message - FailedMatchData.new("#{actual.label} raised #{exception.class} with message matching #{expected.label}", + FailedMatchData.new(description, "#{actual.label} raised #{exception.class} with message matching #{expected.label}", "expected type": ExceptionType.inspect, "actual type": exception.class.inspect, "expected message": value.inspect, "actual message": exception.message.to_s ) else - SuccessfulMatchData.new + SuccessfulMatchData.new(description) end end else - SuccessfulMatchData.new + SuccessfulMatchData.new(description) end end end diff --git a/src/spectator/matchers/failed_match_data.cr b/src/spectator/matchers/failed_match_data.cr index 205b31c..537cf95 100644 --- a/src/spectator/matchers/failed_match_data.cr +++ b/src/spectator/matchers/failed_match_data.cr @@ -15,11 +15,13 @@ module Spectator::Matchers getter values : Array(Tuple(Symbol, String)) # Creates the match data. - def initialize(@failure_message, @values) + def initialize(description, @failure_message, @values) + super(description) end # Creates the match data. - def initialize(@failure_message, **values) + def initialize(description, @failure_message, **values) + super(description) @values = values.to_a end end diff --git a/src/spectator/matchers/match_data.cr b/src/spectator/matchers/match_data.cr index 47b444c..31454f5 100644 --- a/src/spectator/matchers/match_data.cr +++ b/src/spectator/matchers/match_data.cr @@ -3,5 +3,10 @@ module Spectator::Matchers abstract struct MatchData # Indicates whether the match as successful or not. abstract def matched? : Bool + + getter description : String + + def initialize(@description : String) + end end end diff --git a/src/spectator/matchers/predicate_matcher.cr b/src/spectator/matchers/predicate_matcher.cr index 5c43c60..bacfac0 100644 --- a/src/spectator/matchers/predicate_matcher.cr +++ b/src/spectator/matchers/predicate_matcher.cr @@ -24,9 +24,9 @@ module Spectator::Matchers def match(actual : TestExpression(T)) : MatchData forall T snapshot = snapshot_values(actual.value) if match?(snapshot) - SuccessfulMatchData.new + SuccessfulMatchData.new(description) else - FailedMatchData.new("#{actual.label} is not #{expected.label}", **values(snapshot)) + FailedMatchData.new(description, "#{actual.label} is not #{expected.label}", **values(snapshot)) end end @@ -35,9 +35,9 @@ module Spectator::Matchers def negated_match(actual : TestExpression(T)) : MatchData forall T snapshot = snapshot_values(actual.value) if match?(snapshot) - FailedMatchData.new("#{actual.label} is #{expected.label}", **values(snapshot)) + FailedMatchData.new(description, "#{actual.label} is #{expected.label}", **values(snapshot)) else - SuccessfulMatchData.new + SuccessfulMatchData.new(description) end end diff --git a/src/spectator/matchers/respond_matcher.cr b/src/spectator/matchers/respond_matcher.cr index ce69a7e..3f26041 100644 --- a/src/spectator/matchers/respond_matcher.cr +++ b/src/spectator/matchers/respond_matcher.cr @@ -17,9 +17,9 @@ module Spectator::Matchers def match(actual : TestExpression(T)) : MatchData forall T snapshot = snapshot_values(actual.value) if match?(snapshot) - SuccessfulMatchData.new + SuccessfulMatchData.new(description) else - FailedMatchData.new("#{actual.label} does not respond to #{label}", **values(snapshot)) + FailedMatchData.new(description, "#{actual.label} does not respond to #{label}", **values(snapshot)) end end @@ -28,9 +28,9 @@ module Spectator::Matchers def negated_match(actual : TestExpression(T)) : MatchData forall T snapshot = snapshot_values(actual.value) if match?(snapshot) - FailedMatchData.new("#{actual.label} responds to #{label}", **values(snapshot)) + FailedMatchData.new(description, "#{actual.label} responds to #{label}", **values(snapshot)) else - SuccessfulMatchData.new + SuccessfulMatchData.new(description) end end diff --git a/src/spectator/matchers/standard_matcher.cr b/src/spectator/matchers/standard_matcher.cr index 2a01ab3..52cdc67 100644 --- a/src/spectator/matchers/standard_matcher.cr +++ b/src/spectator/matchers/standard_matcher.cr @@ -25,9 +25,9 @@ module Spectator::Matchers # Additionally, `#failure_message` and `#values` are called for a failed match. def match(actual : TestExpression(T)) : MatchData forall T if match?(actual) - SuccessfulMatchData.new + SuccessfulMatchData.new(description) else - FailedMatchData.new(failure_message(actual), values(actual).to_a) + FailedMatchData.new(description, failure_message(actual), values(actual).to_a) end end @@ -39,10 +39,11 @@ module Spectator::Matchers # Otherwise, a `FailedMatchData` instance is returned. # Additionally, `#failure_message_when_negated` and `#negated_values` are called for a failed match. def negated_match(actual : TestExpression(T)) : MatchData forall T + # TODO: Invert description. if does_not_match?(actual) - SuccessfulMatchData.new + SuccessfulMatchData.new(description) else - FailedMatchData.new(failure_message_when_negated(actual), negated_values(actual).to_a) + FailedMatchData.new(description, failure_message_when_negated(actual), negated_values(actual).to_a) end end diff --git a/src/spectator/matchers/start_with_matcher.cr b/src/spectator/matchers/start_with_matcher.cr index 29da717..aaa8846 100644 --- a/src/spectator/matchers/start_with_matcher.cr +++ b/src/spectator/matchers/start_with_matcher.cr @@ -43,9 +43,9 @@ module Spectator::Matchers # This method expects (and uses) the `#starts_with?` method on the value. private def match_starts_with(actual_value, actual_label) if actual_value.starts_with?(expected.value) - SuccessfulMatchData.new + SuccessfulMatchData.new(description) else - FailedMatchData.new("#{actual_label} does not start with #{expected.label} (using #starts_with?)", + FailedMatchData.new(description, "#{actual_label} does not start with #{expected.label} (using #starts_with?)", expected: expected.value.inspect, actual: actual_value.inspect ) @@ -59,9 +59,9 @@ module Spectator::Matchers first = list.first if expected.value === first - SuccessfulMatchData.new + SuccessfulMatchData.new(description) else - FailedMatchData.new("#{actual_label} does not start with #{expected.label} (using expected === first)", + FailedMatchData.new(description, "#{actual_label} does not start with #{expected.label} (using expected === first)", expected: expected.value.inspect, actual: first.inspect, list: list.inspect @@ -73,12 +73,12 @@ module Spectator::Matchers # This method expects (and uses) the `#starts_with?` method on the value. private def negated_match_starts_with(actual_value, actual_label) if actual_value.starts_with?(expected.value) - FailedMatchData.new("#{actual_label} starts with #{expected.label} (using #starts_with?)", + FailedMatchData.new(description, "#{actual_label} starts with #{expected.label} (using #starts_with?)", expected: expected.value.inspect, actual: actual_value.inspect ) else - SuccessfulMatchData.new + SuccessfulMatchData.new(description) end end @@ -89,13 +89,13 @@ module Spectator::Matchers first = list.first if expected.value === first - FailedMatchData.new("#{actual_label} starts with #{expected.label} (using expected === first)", + FailedMatchData.new(description, "#{actual_label} starts with #{expected.label} (using expected === first)", expected: expected.value.inspect, actual: first.inspect, list: list.inspect ) else - SuccessfulMatchData.new + SuccessfulMatchData.new(description) end end end diff --git a/src/spectator/matchers/unordered_array_matcher.cr b/src/spectator/matchers/unordered_array_matcher.cr index 5bbbdf1..81125a7 100644 --- a/src/spectator/matchers/unordered_array_matcher.cr +++ b/src/spectator/matchers/unordered_array_matcher.cr @@ -25,9 +25,9 @@ module Spectator::Matchers missing, extra = array_diff(expected_elements, actual_elements) if missing.empty? && extra.empty? - SuccessfulMatchData.new + SuccessfulMatchData.new(description) else - FailedMatchData.new("#{actual_label} does not contain #{expected.label} (unordered)", + FailedMatchData.new(description, "#{actual_label} does not contain #{expected.label} (unordered)", expected: expected_elements.inspect, actual: actual_elements.inspect, missing: missing.inspect, @@ -44,12 +44,12 @@ module Spectator::Matchers missing, extra = array_diff(expected_elements, actual_elements) if missing.empty? && extra.empty? - FailedMatchData.new("#{actual_label} contains #{expected.label} (unordered)", + FailedMatchData.new(description, "#{actual_label} contains #{expected.label} (unordered)", expected: "Not #{expected_elements.inspect}", actual: actual_elements.inspect, ) else - SuccessfulMatchData.new + SuccessfulMatchData.new(description) end end