File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed
Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -455,6 +455,7 @@ def add!(&blk)
455455 @cutime = cutime + t . cutime
456456 @cstime = cstime + t . cstime
457457 @real = real + t . real
458+ @total = total + t . total
458459 self
459460 end
460461
Original file line number Diff line number Diff line change @@ -150,6 +150,15 @@ def test_bugs_ruby_dev_40906_can_add_in_place_the_time_of_execution_of_the_block
150150 assert_not_equal ( 0 , t . real )
151151 end
152152
153+ # TODO: Consider combining with the above test
154+ def test_add_in_place
155+ t = Benchmark ::Tms . new
156+ assert_equal ( 0 , t . total )
157+
158+ t . add! { 1000 . times do ; '1' ; end }
159+ assert_not_equal ( 0 , t . total )
160+ end
161+
153162 def test_realtime_output
154163 sleeptime = 1.0
155164 realtime = Benchmark . realtime { sleep sleeptime }
You can’t perform that action at this time.
0 commit comments