Class: Test::Unit::FaultLocationDetector
- Inherits:
-
Object
- Object
- Test::Unit::FaultLocationDetector
- Defined in:
- lib/test/unit/fault-location-detector.rb
Instance Method Summary (collapse)
-
- (FaultLocationDetector) initialize(fault, code_snippet_fetcher)
constructor
A new instance of FaultLocationDetector.
- - (Object) split_backtrace_entry(entry)
- - (Boolean) target?(backtrace_entry)
Constructor Details
- (FaultLocationDetector) initialize(fault, code_snippet_fetcher)
A new instance of FaultLocationDetector
8 9 10 11 12 |
# File 'lib/test/unit/fault-location-detector.rb', line 8 def initialize(fault, code_snippet_fetcher) @fault = fault @code_snippet_fetcher = code_snippet_fetcher extract_fault_information end |
Instance Method Details
- (Object) split_backtrace_entry(entry)
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/test/unit/fault-location-detector.rb', line 14 def split_backtrace_entry(entry) match_data = /\A(.+):(\d+)(?::(.*))?\z/.match(entry) return nil if match_data.nil? file, line_number, context = match_data.to_a[1..-1] line_number = line_number.to_i if /\Ain `(.+?)'/ =~ context method_name = $1 else method_name = nil end [file, line_number, context, method_name] end |
- (Boolean) target?(backtrace_entry)
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/test/unit/fault-location-detector.rb', line 27 def target?(backtrace_entry) file, line_number, context, method_name = split_backtrace_entry(backtrace_entry) _ = context return false if file.nil? if @fault_source_location target_source_location?(file, line_number, method_name) elsif @fault_method_name target_method?(method_name) else true end end |