Class: Roby::Test::ExecutionExpectations::Unmet

Inherits:
Minitest::Assertion
  • Object
show all
Defined in:
lib/roby/test/execution_expectations.rb

Instance Method Summary collapse

Constructor Details

#initialize(expectations_with_explanations, propagation_info) ⇒ Unmet

Returns a new instance of Unmet.



357
358
359
360
361
362
# File 'lib/roby/test/execution_expectations.rb', line 357

def initialize(expectations_with_explanations, propagation_info)
    super()

    @expectations = expectations_with_explanations
    @propagation_info = propagation_info
end

Instance Method Details

#each_original_exceptionObject



364
365
366
367
368
369
370
# File 'lib/roby/test/execution_expectations.rb', line 364

def each_original_exception
    return enum_for(__method__) unless block_given?

    @expectations.each do |(_, e)|
        yield(e) if e.kind_of?(Exception)
    end
end

#pretty_print(pp) ⇒ Object



372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
# File 'lib/roby/test/execution_expectations.rb', line 372

def pretty_print(pp)
    pp.text "#{@expectations.size} unmet expectations"
    @expectations.each do |exp, explanation|
        pp.breakable
        exp.pretty_print(pp)
        if explanation
            pp.text ", "
            exp.format_unachievable_explanation(pp, explanation)
        end
    end

    return if @propagation_info.empty?

    pp.breakable
    @propagation_info.pretty_print(pp)
end

#to_sObject



389
390
391
# File 'lib/roby/test/execution_expectations.rb', line 389

def to_s
    PP.pp(self, "".dup, 1).strip
end