7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/minitest/rerun.rb', line 7
def rerun_command(msg)
info = msg.to_s.split("\n")[1]
location_part = info[/ \[((.*?):\d+)\]:/]
location = $1
file = $2
name = if location_part
info.sub(location_part, "")
else
info.sub(/:$/, "")
end
if !location && msg.respond_to?(:name)
method = msg.method(msg.name)
file, line = method.source_location
location = "#{file}:#{line}"
end
file = test_file(file)
line = colorize(:red, "ruby #{file || "unknown"} -n '#{name.gsub(%{'}, %{'"'"'})}' ")
line << colorize(:cyan, "# #{relativize(location)}") if location
line
end
|