diff --git a/ChangeLog b/ChangeLog index 83ffc91bd2..d85932fd36 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Sat Apr 3 03:19:01 2010 Kazuhiro NISHIYAMA + + * lib/benchmark.rb (Benchmark::Tms#add): fix NameError. + [ruby-dev:40906] + + * test/benchmark/test_benchmark.rb: add a test for above. + Sat Apr 3 01:50:02 2010 Nobuyoshi Nakada * lib/rdoc/parser/ruby.rb (RDoc#make_message): no empty lines. diff --git a/lib/benchmark.rb b/lib/benchmark.rb index 9a0bbef596..8e7f778e2d 100644 --- a/lib/benchmark.rb +++ b/lib/benchmark.rb @@ -440,7 +440,7 @@ module Benchmark # # An in-place version of #add. # - def add! + def add!(&blk) t = Benchmark::measure(&blk) @utime = utime + t.utime @stime = stime + t.stime diff --git a/test/benchmark/test_benchmark.rb b/test/benchmark/test_benchmark.rb new file mode 100644 index 0000000000..6d390558ac --- /dev/null +++ b/test/benchmark/test_benchmark.rb @@ -0,0 +1,10 @@ +require "test/unit" +require "benchmark" + +class TestBenchmark < Test::Unit::TestCase + def test_add! + assert_nothing_raised("[ruby-dev:40906]") do + Benchmark::Tms.new.add! {} + end + end +end