class Roby::Test::ExecutionExpectations::UnexpectedErrors

Public Class Methods

new(errors) click to toggle source
# File lib/roby/test/execution_expectations.rb, line 365
def initialize(errors)
    @errors = errors
end

Public Instance Methods

droby_dump(peer) click to toggle source
# File lib/roby/test/execution_expectations.rb, line 379
def droby_dump(peer)
    UnexpectedErrors.new(
        @errors.map { |e| peer.dump(e) })
end
each_original_exception() { |e| ... } click to toggle source
# File lib/roby/test/execution_expectations.rb, line 369
def each_original_exception
    return enum_for(__method__) if !block_given?

    @errors.each do |_, e|
        if e.kind_of?(Exception)
            yield(e)
        end
    end
end
proxy(peer) click to toggle source
# File lib/roby/test/execution_expectations.rb, line 384
def proxy(peer)
    UnexpectedErrors.new(
        @errors.map { |e| peer.local_object(e) })
end
to_s() click to toggle source
# File lib/roby/test/execution_expectations.rb, line 389
def to_s
    "#{@errors.size} unexpected errors\n" +
    @errors.each_with_index.map do |e, i|
        formatted_execution_exception =
            "[#{i + 1}/#{@errors.size}] " + Roby.format_exception(e).join("\n")

        if e.kind_of?(ExecutionException)
            e = e.exception
        end
        if e.backtrace && !e.backtrace.empty?
            formatted_execution_exception += "\n    " + e.backtrace.join("\n    ")
        end

        sub_exceptions = Roby.flatten_exception(e)
        sub_exceptions.delete(e)
        formatted_sub_exceptions = sub_exceptions.each_with_index.map do |sub_e, sub_i|
            formatted = "[#{sub_i}] " + Roby.format_exception(sub_e).join("\n    ")
            backtrace = Roby.format_backtrace(sub_e)
            if !backtrace.empty?
                formatted += "    " + backtrace.join("\n    ")
            end
            formatted
        end.join("\n  ")

        if !formatted_sub_exceptions.empty?
            formatted_execution_exception += "\n  " + formatted_sub_exceptions
        end
        formatted_execution_exception
    end.join("\n")
end