test/printers_test.rb in ruby-prof-0.16.2 vs test/printers_test.rb in ruby-prof-0.17.0
- old
+ new
@@ -61,10 +61,30 @@
assert File.size(existant_file) > 0
end
end
end
+ def test_refuses_io_objects
+ p = RubyProf::MultiPrinter.new(@result)
+ begin
+ p.print(STDOUT)
+ flunk "should have raised an ArgumentError"
+ rescue ArgumentError => e
+ assert_match(/IO/, e.to_s)
+ end
+ end
+
+ def test_refuses_non_hashes
+ p = RubyProf::MultiPrinter.new (@result)
+ begin
+ p.print([])
+ flunk "should have raised an ArgumentError"
+ rescue ArgumentError => e
+ assert_match(/hash/, e.to_s)
+ end
+ end
+
def test_flat_string
output = helper_test_flat_string(RubyProf::FlatPrinter)
refute_match(/prime.rb/, output)
end
@@ -118,10 +138,10 @@
printer = RubyProf::CallTreePrinter.new(@result)
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(/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
def do_nothing