Class: Roby::Test::ExecutionExpectations::EmitGenerator

Inherits:
Expectation show all
Defined in:
lib/roby/test/execution_expectations.rb

Instance Attribute Summary collapse

Attributes inherited from Expectation

#backtrace

Instance Method Summary collapse

Methods inherited from Expectation

#filter_result, #filter_result_with, #format_unachievable_explanation

Constructor Details

#initialize(generator, backtrace) ⇒ EmitGenerator

Returns a new instance of EmitGenerator.



998
999
1000
1001
1002
1003
1004
1005
1006
1007
# File 'lib/roby/test/execution_expectations.rb', line 998

def initialize(generator, backtrace)
    super(backtrace)
    @generator = generator
    @related_error_matcher =
        Queries::LocalizedErrorMatcher
        .new
        .with_origin(@generator)
        .emitted
        .to_execution_exception_matcher
end

Instance Attribute Details

#generatorObject (readonly)

Returns the value of attribute generator.



996
997
998
# File 'lib/roby/test/execution_expectations.rb', line 996

def generator
  @generator
end

Instance Method Details

#explain_unachievable(_propagation_info) ⇒ Object



1029
1030
1031
# File 'lib/roby/test/execution_expectations.rb', line 1029

def explain_unachievable(_propagation_info)
    @generator.unreachability_reason
end

#relates_to_error?(error) ⇒ Boolean

Returns:

  • (Boolean)


1033
1034
1035
# File 'lib/roby/test/execution_expectations.rb', line 1033

def relates_to_error?(error)
    @related_error_matcher === error
end

#return_objectObject



1021
1022
1023
# File 'lib/roby/test/execution_expectations.rb', line 1021

def return_object
    @emitted_events.first
end

#to_sObject



1009
1010
1011
# File 'lib/roby/test/execution_expectations.rb', line 1009

def to_s
    "#{@generator} should be emitted"
end

#unachievable?(_propagation_info) ⇒ Boolean

Returns:

  • (Boolean)


1025
1026
1027
# File 'lib/roby/test/execution_expectations.rb', line 1025

def unachievable?(_propagation_info)
    @generator.unreachable?
end

#update_match(propagation_info) ⇒ Object



1013
1014
1015
1016
1017
1018
1019
# File 'lib/roby/test/execution_expectations.rb', line 1013

def update_match(propagation_info)
    @emitted_events =
        propagation_info
        .emitted_events
        .find_all { |ev| ev.generator == @generator }
    !@emitted_events.empty?
end