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

Constructor Details

#initialize(generator, backtrace) ⇒ EmitGenerator

Returns a new instance of EmitGenerator.



809
810
811
812
813
814
815
# File 'lib/roby/test/execution_expectations.rb', line 809

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

Instance Attribute Details

#generatorObject (readonly)

Returns the value of attribute generator.



807
808
809
# File 'lib/roby/test/execution_expectations.rb', line 807

def generator
  @generator
end

Instance Method Details

#explain_unachievable(propagation_info) ⇒ Object



835
836
837
# File 'lib/roby/test/execution_expectations.rb', line 835

def explain_unachievable(propagation_info)
    @generator.unreachability_reason
end

#relates_to_error?(error) ⇒ Boolean

Returns:

  • (Boolean)


839
840
841
# File 'lib/roby/test/execution_expectations.rb', line 839

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

#return_objectObject



827
828
829
# File 'lib/roby/test/execution_expectations.rb', line 827

def return_object
    @emitted_events.first
end

#to_sObject



817
818
819
# File 'lib/roby/test/execution_expectations.rb', line 817

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

#unachievable?(propagation_info) ⇒ Boolean

Returns:

  • (Boolean)


831
832
833
# File 'lib/roby/test/execution_expectations.rb', line 831

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

#update_match(propagation_info) ⇒ Object



821
822
823
824
825
# File 'lib/roby/test/execution_expectations.rb', line 821

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