Sha256: 60b040756283779c60c06850719c87baa8c87af1e1ba9e062288e432b5c304f5
Contents?: true
Size: 1.83 KB
Versions: 3
Compression:
Stored size: 1.83 KB
Contents
#!/usr/bin/env ruby require 'test/unit' require 'ruby-prof' require 'prime' require 'test_helper' # -- Tests ---- class PrintersTest < Test::Unit::TestCase def setup @result = RubyProf.profile do run_primes end end def test_printers printer = RubyProf::FlatPrinter.new(@result) printer.print(STDOUT) printer = RubyProf::GraphHtmlPrinter.new(@result) printer.print printer = RubyProf::GraphPrinter.new(@result) printer.print printer = RubyProf::CallTreePrinter.new(@result) printer.print(STDOUT) # we should get here assert(true) end def test_flatprinter_duckfriendliness output = '' printer = RubyProf::FlatPrinter.new(@result) assert_nothing_raised { printer.print( output ) } assert_match( /Thread ID: \d+/i, output ) assert_match( /Total: \d+\.\d+/i, output ) assert_match( /Object#run_primes/i, output ) end def test_graphhtmlprinter_duckfriendliness output = '' printer = RubyProf::GraphHtmlPrinter.new(@result) assert_nothing_raised { printer.print(output) } assert_match( /DTD HTML 4\.01/i, output ) assert_match( %r{<th>Total Time</th>}i, output ) assert_match( /Object#run_primes/i, output ) end def test_graphprinter_duckfriendliness output = '' printer = RubyProf::GraphPrinter.new(@result) assert_nothing_raised { printer.print(output) } assert_match( /Thread ID: \d+/i, output ) assert_match( /Total Time: \d+\.\d+/i, output ) assert_match( /Object#run_primes/i, output ) end def test_calltreeprinter_duckfriendliness output = '' printer = RubyProf::CallTreePrinter.new(@result) assert_nothing_raised { printer.print(output) } assert_match(/fn=Object::find_primes/i, output) assert_match(/events: process_time/i, output) end end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
jeremy-ruby-prof-0.6.1 | test/printers_test.rb |
ruby-prof-0.6.0 | test/printers_test.rb |
ruby-prof-0.6.0-x86-mswin32-60 | test/printers_test.rb |