test/printers_test.rb in ruby-prof-0.15.9 vs test/printers_test.rb in ruby-prof-0.16.0
- old
+ new
@@ -21,11 +21,11 @@
printer = RubyProf::CallInfoPrinter.new(@result)
printer.print(output)
printer = RubyProf::CallTreePrinter.new(@result)
- printer.print(output)
+ printer.print()
printer = RubyProf::FlatPrinter.new(@result)
printer.print(output)
printer = RubyProf::FlatPrinterWithLineNumbers.new(@result)
@@ -54,11 +54,11 @@
printer = RubyProf::CallStackPrinter.new(@result)
File.open("#{output_dir}/stack.html", "w") {|f| printer.print(f, :application => "primes")}
printer = RubyProf::MultiPrinter.new(@result)
printer.print(:path => "#{output_dir}", :profile => "multi", :application => "primes")
- for file in ['graph.dot', 'multi.flat.txt', 'multi.graph.html', 'multi.grind.dat', 'multi.stack.html', 'stack.html']
+ for file in ['graph.dot', 'multi.flat.txt', 'multi.graph.html', "multi.callgrind.out.#{$$}", 'multi.stack.html', 'stack.html']
existant_file = output_dir + '/' + file
assert File.size(existant_file) > 0
end
end
end
@@ -113,12 +113,14 @@
assert_match(/Total Time: \d+\.\d+/i, output)
assert_match(/Object#run_primes/i, output)
end
def test_call_tree_string
- output = ''
printer = RubyProf::CallTreePrinter.new(@result)
- printer.print(output)
+ printer.print(:profile => "lolcat", :path => RubyProf.tmpdir)
+ main_output_file_name = File.join(RubyProf.tmpdir, "lolcat.callgrind.out.#{$$}")
+ assert(File.exist?(main_output_file_name))
+ output = File.read(main_output_file_name)
assert_match(/fn=Object#find_primes/i, output)
assert_match(/events: wall_time/i, output)
refute_match(/d\d\d\d\d\d/, output) # old bug looked [in error] like Object::run_primes(d5833116)
end