Placeholder negate method to get around first issue

All match data values now have a negate method, but it might not do 
anything.
With this change, a segfault occurs during output.

Invalid memory access (signal 11) at address 0x0
[0x55f0f6604906] *CallStack::print_backtrace:Int32 +118
[0x55f0f65f52c0] __crystal_sigfault_handler +192
[0x7fa1f7a8a890] ???
[0x55f0f6612cf6] *Slice(T):🆕read_only<Pointer(UInt8), Int32, 
Bool>:Slice(UInt8) +22
[0x55f0f6608265] *String#to_slice:Slice(UInt8) +37
[0x55f0f6608208] *String#to_s<String::Builder>:Nil +24
[0x55f0f6611b91] *String::Builder +17
[0x55f0f667ab7a] 
*Spectator::Matchers::EqualityMatcher::MatchData(String, String) +26
Program exited because of a segmentation fault (11)
This commit is contained in:
Michael Miller 2019-04-06 11:55:37 -06:00
parent 61ee8ce1e1
commit 0f4a92e5b2
2 changed files with 5 additions and 1 deletions

View file

@ -25,7 +25,7 @@ module Spectator::Expectations
if @negated if @negated
labeled_values.each do |labeled_value| labeled_values.each do |labeled_value|
value = labeled_value.value value = labeled_value.value
value.negate if value.responds_to?(:negate) value.negate
end end
end end
end end

View file

@ -2,5 +2,9 @@ module Spectator::Matchers
# Abstract base for all match data values. # Abstract base for all match data values.
# All sub-classes are expected to implement their own `#to_s`. # All sub-classes are expected to implement their own `#to_s`.
private abstract class MatchDataValue private abstract class MatchDataValue
# Placeholder negation method.
def negate
# ...
end
end end
end end