summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKoichi Sasada <ko1@atdot.net>2026-02-03 16:49:04 +0900
committerKoichi Sasada <ko1@atdot.net>2026-02-03 18:03:45 +0900
commit5ebccee59dc327ffb9e46a53cbe2ff853247fcd6 (patch)
tree6ea4d3644ab8ec57bb62afaeac139af81ae57356
parentf045a820edcf3a198c03b4eaa9a849418e31d469 (diff)
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' ```
-rw-r--r--tool/lib/core_assertions.rb5
1 files changed, 3 insertions, 2 deletions
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)