8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/minitest/line_plugin.rb', line 8
def self.plugin_line_init(options)
return unless exp_line = options[:line]
methods = Runnable.runnables.flat_map do |runnable|
runnable.runnable_methods.map do |name|
[name, runnable.instance_method(name)]
end
end.uniq
current_filename = nil
tests = {}
methods.each do |name, meth|
next unless loc = meth.source_location
current_filename ||= loc[0]
next unless current_filename == loc[0]
tests[loc[1]] = name
end
_, main_test = tests.sort_by { |k, v| -k }.detect do |line, name|
exp_line >= line
end
raise "Could not find test method after line #{exp_line}" unless main_test
options[:filter] = main_test
end
|