You are on page 1of 1

#$null_stream = $stdout

$null_stream = File.open(File::NULL, 'w')


if defined? Minitest
RSpec = Minitest::Spec
module Minitest
class << self
alias :old_process_args :process_args
def process_args *args
options = old_process_args(*args)
options[:io] = $null_stream
options
end
end
end
def start_runner
Minitest.run []
end
else
require 'rspec'
def start_runner
RSpec::Core::Runner.run [], $null_stream, $null_stream
end
end
tp = TracePoint.new(:inline_cache_hit, :inline_cache_miss) do |x|
p x.event
end
RSpec.send :describe, "foo" do
N = (ENV['N'] || 100).to_i.times do |x|
it "foo #{x.to_s}" do
end
end
end
#start = Process.clock_gettime Process::CLOCK_MONOTONIC, :microsecond
tp.enable
start_runner
tp.disable
#p Process.clock_gettime(Process::CLOCK_MONOTONIC, :microsecond) - start

You might also like