From 5ebccee59dc327ffb9e46a53cbe2ff853247fcd6 Mon Sep 17 00:00:00 2001 From: Koichi Sasada Date: Tue, 3 Feb 2026 16:49:04 +0900 Subject: check zeros raise when assert_linear_performance measures only zeros to check the following error: ``` 1) Error: TestRegexp#test_linear_performance: Test::Unit::ProxyError: nil can't be coerced into Integer /home/opc/ruby/src/master/test/ruby/test_regexp.rb:2301:in 'TestRegexp#test_linear_performance' ``` --- tool/lib/core_assertions.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'tool') diff --git a/tool/lib/core_assertions.rb b/tool/lib/core_assertions.rb index e29a0e3c25..5ca318a598 100644 --- a/tool/lib/core_assertions.rb +++ b/tool/lib/core_assertions.rb @@ -911,10 +911,11 @@ eom first = seq.first *arg = pre.call(first) - times = (0..(rehearsal || (2 * first))).map do + raw_times = (0..(rehearsal || (2 * first))).map do measure[arg, "rehearsal"].nonzero? end - times.compact! + times = raw_times.compact + raise "all measurements are zero: #{raw_times.inspect}" if times.empty? tmin, tmax = times.minmax # safe_factor * tmax * rehearsal_time_variance_factor(equals to 1 when variance is small) -- cgit v1.2.3