mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Add check_warning_flags to leakchecker
This commit is contained in:
parent
8c5430e274
commit
729b7ce270
1 changed files with 22 additions and 0 deletions
|
@ -7,6 +7,7 @@ class LeakChecker
|
||||||
@env_info = find_env
|
@env_info = find_env
|
||||||
@encoding_info = find_encodings
|
@encoding_info = find_encodings
|
||||||
@old_verbose = $VERBOSE
|
@old_verbose = $VERBOSE
|
||||||
|
@old_warning_flags = find_warning_flags
|
||||||
end
|
end
|
||||||
|
|
||||||
def check(test_name)
|
def check(test_name)
|
||||||
|
@ -17,6 +18,7 @@ class LeakChecker
|
||||||
check_env(test_name),
|
check_env(test_name),
|
||||||
check_encodings(test_name),
|
check_encodings(test_name),
|
||||||
check_verbose(test_name),
|
check_verbose(test_name),
|
||||||
|
check_warning_flags(test_name),
|
||||||
]
|
]
|
||||||
GC.start if leaks.any?
|
GC.start if leaks.any?
|
||||||
end
|
end
|
||||||
|
@ -230,6 +232,26 @@ class LeakChecker
|
||||||
return leaked
|
return leaked
|
||||||
end
|
end
|
||||||
|
|
||||||
|
WARNING_CATEGORIES = %i[deprecated experimental].freeze
|
||||||
|
|
||||||
|
def find_warning_flags
|
||||||
|
WARNING_CATEGORIES.to_h do |category|
|
||||||
|
[category, Warning[category]]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def check_warning_flags(test_name)
|
||||||
|
new_warning_flags = find_warning_flags
|
||||||
|
leaked = false
|
||||||
|
WARNING_CATEGORIES.each do |category|
|
||||||
|
if new_warning_flags[category] != @old_warning_flags[category]
|
||||||
|
leaked = true
|
||||||
|
puts "Warning[#{category.inspect}] changed: #{test_name} : #{@old_warning_flags[category]} to #{new_warning_flags[category]}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return leaked
|
||||||
|
end
|
||||||
|
|
||||||
def puts(*a)
|
def puts(*a)
|
||||||
output = MiniTest::Unit.output
|
output = MiniTest::Unit.output
|
||||||
if defined?(output.set_encoding)
|
if defined?(output.set_encoding)
|
||||||
|
|
Loading…
Add table
Reference in a new issue