diff --git a/test/test_helpers/assert_allocations_helper.rb b/test/test_helpers/assert_allocations_helper.rb index 516a250230..3570efccaa 100644 --- a/test/test_helpers/assert_allocations_helper.rb +++ b/test/test_helpers/assert_allocations_helper.rb @@ -12,6 +12,12 @@ def assert_allocations(count_map, &block) total = trace.allocations.all.size count = count_map[ruby_version] + if count.nil? + raise "No allocation count mapped for Ruby version #{ruby_version}. " \ + "Available versions: #{count_map.keys.sort.join(', ')}. " \ + "Actual allocations: #{total}" + end + assert_equal count, total, "Expected #{count} allocations, got #{total} allocations" end