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.
835 836 837 838 |
# File 'lib/roby/test/execution_expectations.rb', line 835 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.
833 834 835 |
# File 'lib/roby/test/execution_expectations.rb', line 833 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.
851 852 853 |
# File 'lib/roby/test/execution_expectations.rb', line 851 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
887 888 889 |
# File 'lib/roby/test/execution_expectations.rb', line 887 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
878 879 880 881 |
# File 'lib/roby/test/execution_expectations.rb', line 878 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.
859 860 861 862 863 864 865 866 867 868 869 870 871 |
# File 'lib/roby/test/execution_expectations.rb', line 859 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.
855 856 857 |
# File 'lib/roby/test/execution_expectations.rb', line 855 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.
847 848 849 |
# File 'lib/roby/test/execution_expectations.rb', line 847 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
843 844 845 |
# File 'lib/roby/test/execution_expectations.rb', line 843 def update_match(_propagation_info) true end |