diff options
| author | Koichi Sasada <ko1@atdot.net> | 2026-02-03 16:49:04 +0900 |
|---|---|---|
| committer | Koichi Sasada <ko1@atdot.net> | 2026-02-03 18:03:45 +0900 |
| commit | 5ebccee59dc327ffb9e46a53cbe2ff853247fcd6 (patch) | |
| tree | 6ea4d3644ab8ec57bb62afaeac139af81ae57356 | |
| parent | f045a820edcf3a198c03b4eaa9a849418e31d469 (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.rb | 5 |
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) |
