Class: Roby::Test::ExecutionExpectations::Expectation Private
- Defined in:
- lib/roby/test/execution_expectations.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Null implementation of an expectation
Direct Known Subclasses
Achieve, BecomeUnreachable, EmitGenerator, EmitGeneratorModel, ErrorExpectation, FailsToStart, Finalize, HaveFrameworkError, IgnoreErrorsFrom, Maintain, NotBecomeUnreachable, NotEmitGenerator, NotEmitGeneratorModel, NotFinalize, PromiseFinishes, Quarantine
Instance Attribute Summary collapse
- #backtrace ⇒ Object readonly private
Instance Method Summary collapse
- #explain_unachievable(_propagation_info) ⇒ Object private
-
#filter_result(result) ⇒ Object
private
Filter the result of this expectation before returning it to the user.
-
#filter_result_with(&block) ⇒ Object
private
Add a block that should be used to filter the result of this expectation before returning it to the caller.
- #format_unachievable_explanation(pp, explanation) ⇒ Object private
-
#initialize(backtrace) ⇒ Expectation
constructor
private
A new instance of Expectation.
- #relates_to_error?(_error) ⇒ Boolean private
- #unachievable?(_propagation_info) ⇒ Boolean private
-
#update_match(_propagation_info) ⇒ Object
private
Verifies whether the expectation is met at this point.
Constructor Details
#initialize(backtrace) ⇒ Expectation
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Expectation.
830 831 832 833 |
# File 'lib/roby/test/execution_expectations.rb', line 830 def initialize(backtrace) @backtrace = backtrace @result_filters = [] end |
Instance Attribute Details
#backtrace ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
828 829 830 |
# File 'lib/roby/test/execution_expectations.rb', line 828 def backtrace @backtrace end |
Instance Method Details
#explain_unachievable(_propagation_info) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
846 847 848 |
# File 'lib/roby/test/execution_expectations.rb', line 846 def explain_unachievable(_propagation_info) nil end |
#filter_result(result) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Filter the result of this expectation before returning it to the user
882 883 884 |
# File 'lib/roby/test/execution_expectations.rb', line 882 def filter_result(result) @result_filters.inject(result) { |o, b| b.call(o) } end |
#filter_result_with(&block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Add a block that should be used to filter the result of this expectation before returning it to the caller
This is meant to be used to re-use general expectations in more specific ones
873 874 875 876 |
# File 'lib/roby/test/execution_expectations.rb', line 873 def filter_result_with(&block) @result_filters << block self end |
#format_unachievable_explanation(pp, explanation) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
854 855 856 857 858 859 860 861 862 863 864 865 866 |
# File 'lib/roby/test/execution_expectations.rb', line 854 def format_unachievable_explanation(pp, explanation) pp.text "but it did not because of " case explanation when Exception msg = Roby.format_exception(explanation, with_backtrace: true) msg.each do |line| pp.text line pp.breakable end else explanation.pretty_print(pp) end end |
#relates_to_error?(_error) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
850 851 852 |
# File 'lib/roby/test/execution_expectations.rb', line 850 def relates_to_error?(_error) false end |
#unachievable?(_propagation_info) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
842 843 844 |
# File 'lib/roby/test/execution_expectations.rb', line 842 def unachievable?(_propagation_info) false end |
#update_match(_propagation_info) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Verifies whether the expectation is met at this point
This method is meant to update
838 839 840 |
# File 'lib/roby/test/execution_expectations.rb', line 838 def update_match(_propagation_info) true end |