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.



1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
# File 'lib/roby/test/execution_expectations.rb', line 1060

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.



1058
1059
1060
# File 'lib/roby/test/execution_expectations.rb', line 1058

def generator
  @generator
end

Instance Method Details

#explain_unachievable(_propagation_info) ⇒ Object



1091
1092
1093
# File 'lib/roby/test/execution_expectations.rb', line 1091

def explain_unachievable(_propagation_info)
    @generator.unreachability_reason
end

#relates_to_error?(error) ⇒ Boolean

Returns:

  • (Boolean)


1095
1096
1097
# File 'lib/roby/test/execution_expectations.rb', line 1095

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

#return_objectObject



1083
1084
1085
# File 'lib/roby/test/execution_expectations.rb', line 1083

def return_object
    @emitted_events.first
end

#to_sObject



1071
1072
1073
# File 'lib/roby/test/execution_expectations.rb', line 1071

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

#unachievable?(_propagation_info) ⇒ Boolean

Returns:

  • (Boolean)


1087
1088
1089
# File 'lib/roby/test/execution_expectations.rb', line 1087

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

#update_match(propagation_info) ⇒ Object



1075
1076
1077
1078
1079
1080
1081
# File 'lib/roby/test/execution_expectations.rb', line 1075

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