lib/minitest/test_task.rb in minitest-5.24.1 vs lib/minitest/test_task.rb in minitest-5.25.0
- old
+ new
@@ -148,11 +148,11 @@
ENV["FILTER"]
warn "N is deprecated in Minitest::TestTask. Use MT_CPU instead" if
ENV["N"] && ENV["N"].to_i > 0
lib_extras = (ENV["MT_LIB_EXTRAS"] || "").split File::PATH_SEPARATOR
- self.libs[0,0] = lib_extras
+ self.libs[0, 0] = lib_extras
extra_args << "-n" << ENV["N"] if ENV["N"]
extra_args << "-e" << ENV["X"] if ENV["X"]
extra_args.concat Shellwords.split(ENV["TESTOPTS"]) if ENV["TESTOPTS"]
extra_args.concat Shellwords.split(ENV["FILTER"]) if ENV["FILTER"]
@@ -167,11 +167,11 @@
end
def define # :nodoc:
desc "Run the test suite. Use N, X, A, and TESTOPTS to add flags/args."
task name do
- ruby make_test_cmd, verbose:verbose
+ ruby make_test_cmd, verbose: verbose
end
desc "Print out the test command. Good for profiling and other tools."
task "#{name}:cmd" do
puts "ruby #{make_test_cmd}"
@@ -181,11 +181,11 @@
task "#{name}:isolated" do
tests = Dir[*self.test_globs].uniq
# 3 seems to be the magic number... (tho not by that much)
bad, good, n = {}, [], (ENV.delete("K") || 3).to_i
- file = ENV.delete("F")
+ file = ENV.delete "F"
times = {}
tt0 = Time.now
n.threads_do tests.sort do |path|
@@ -242,11 +242,11 @@
end
end
task "#{name}:deps" => "#{name}:isolated" # now just an alias
- desc "Show bottom 25 tests wrt time."
+ desc "Run the test suite and report the slowest 25 tests."
task "#{name}:slow" do
sh ["rake #{name} A=-v",
"egrep '#test_.* s = .'",
"sort -n -k2 -t=",
"tail -25"].join " | "
@@ -266,15 +266,15 @@
runner << framework
runner.concat tests
runner = runner.join "; "
args = []
- args << "-I#{libs.join(File::PATH_SEPARATOR)}" unless libs.empty?
+ args << "-I#{libs.join File::PATH_SEPARATOR}" unless libs.empty?
args << "-w" if warning
- args << '-e'
+ args << "-e"
args << "'#{runner}'"
- args << '--'
+ args << "--"
args << extra_args.map(&:shellescape)
args.join " "
end
end
@@ -291,13 +291,13 @@
close
end
end
class Integer # :nodoc:
- def threads_do(jobs) # :nodoc:
+ def threads_do jobs # :nodoc:
q = Work.new jobs
- self.times.map {
+ Array.new(self) {
Thread.new do
while job = q.pop # go until quit value
yield job
end
end