Class: Roby::Test::ExecutionExpectations::ErrorExpectation
Instance Attribute Summary
Attributes inherited from Expectation
#backtrace
Instance Method Summary
collapse
Methods inherited from Expectation
#explain_unachievable, #unachievable?
Constructor Details
#initialize(matcher, backtrace) ⇒ ErrorExpectation
Returns a new instance of ErrorExpectation.
845
846
847
848
849
850
|
# File 'lib/roby/test/execution_expectations.rb', line 845
def initialize(matcher, backtrace)
super(backtrace)
@matcher = matcher.to_execution_exception_matcher
@matched_execution_exceptions = Array.new
@matched_exceptions = Array.new
end
|
Instance Method Details
#relates_to_error?(execution_exception) ⇒ Boolean
874
875
876
877
878
879
|
# File 'lib/roby/test/execution_expectations.rb', line 874
def relates_to_error?(execution_exception)
@matched_execution_exceptions.include?(execution_exception) ||
@matched_exceptions.include?(execution_exception.exception) ||
Roby.flatten_exception(execution_exception.exception).
any? { |e| @matched_exceptions.include?(e) }
end
|
#return_object ⇒ Object
881
882
883
|
# File 'lib/roby/test/execution_expectations.rb', line 881
def return_object
@matched_execution_exceptions.first
end
|
#update_match(exceptions, emitted_events) ⇒ Object
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
|
# File 'lib/roby/test/execution_expectations.rb', line 852
def update_match(exceptions, emitted_events)
@matched_execution_exceptions = exceptions.
find_all { |error| @matcher === error }
matched_exceptions = @matched_execution_exceptions.
map(&:exception).to_set
emitted_events.each do |ev|
next if !ev.generator.respond_to?(:symbol) || ev.generator.symbol != :internal_error
ev.context.each do |obj|
if obj.kind_of?(Exception) && (@matcher === ExecutionException.new(obj))
matched_exceptions << obj
end
end
end
@matched_exceptions = matched_exceptions.flat_map do |e|
Roby.flatten_exception(e).to_a
end.to_set
!@matched_exceptions.empty?
end
|