module Minitest::Line
Public Class Methods
tests_with_lines()
click to toggle source
# File lib/minitest/line_plugin.rb, line 6 def tests_with_lines target_file = $0 methods_with_lines(target_file).concat describes_with_lines(target_file) end
Private Class Methods
describes_with_lines(target_file)
click to toggle source
# File lib/minitest/line_plugin.rb, line 25 def describes_with_lines(target_file) runnables.map do |runnable| next unless caller = runnable.instance_variable_defined?(:@minitest_line_caller) && runnable.instance_variable_get(:@minitest_line_caller) next unless line = caller.detect { |l| l.include?(target_file) } ["/#{Regexp.escape(runnable.name)}/", line[/:(\d+):in/, 1].to_i] end.compact end
methods_with_lines(target_file)
click to toggle source
# File lib/minitest/line_plugin.rb, line 13 def methods_with_lines(target_file) runnables.flat_map do |runnable| rname = runnable.name runnable.runnable_methods.map do |name| file, line = runnable.instance_method(name).source_location next unless file == target_file test_name = (rname ? "#{rname}##{name}" : name) [test_name, line] end end.uniq.compact end
runnables()
click to toggle source
# File lib/minitest/line_plugin.rb, line 33 def runnables Minitest::Runnable.runnables end