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.



1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
# File 'lib/roby/test/execution_expectations.rb', line 1055

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.



1053
1054
1055
# File 'lib/roby/test/execution_expectations.rb', line 1053

def generator
  @generator
end

Instance Method Details

#explain_unachievable(_propagation_info) ⇒ Object



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

def explain_unachievable(_propagation_info)
    @generator.unreachability_reason
end

#relates_to_error?(error) ⇒ Boolean

Returns:

  • (Boolean)


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

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

#return_objectObject



1078
1079
1080
# File 'lib/roby/test/execution_expectations.rb', line 1078

def return_object
    @emitted_events.first
end

#to_sObject



1066
1067
1068
# File 'lib/roby/test/execution_expectations.rb', line 1066

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

#unachievable?(_propagation_info) ⇒ Boolean

Returns:

  • (Boolean)


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

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

#update_match(propagation_info) ⇒ Object



1070
1071
1072
1073
1074
1075
1076
# File 'lib/roby/test/execution_expectations.rb', line 1070

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