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.



362
363
364
365
366
367
# File 'lib/roby/test/execution_expectations.rb', line 362

def initialize(expectations_with_explanations, propagation_info)
    super()

    @expectations = expectations_with_explanations
    @propagation_info = propagation_info
end

Instance Method Details

#each_original_exceptionObject



369
370
371
372
373
374
375
# File 'lib/roby/test/execution_expectations.rb', line 369

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



377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
# File 'lib/roby/test/execution_expectations.rb', line 377

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



394
395
396
# File 'lib/roby/test/execution_expectations.rb', line 394

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