ruby-changes:59523
From: Kazuhiro <ko1@a...>
Date: Fri, 27 Dec 2019 13:07:33 +0900 (JST)
Subject: [ruby-changes:59523] 729b7ce270 (master): Add check_warning_flags to leakchecker
https://git.ruby-lang.org/ruby.git/commit/?id=729b7ce270 From 729b7ce27058ed4b41d5facbb6b912b8e7c6a960 Mon Sep 17 00:00:00 2001 From: Kazuhiro NISHIYAMA <zn@m...> Date: Fri, 27 Dec 2019 13:06:31 +0900 Subject: Add check_warning_flags to leakchecker diff --git a/tool/lib/leakchecker.rb b/tool/lib/leakchecker.rb index 57e2866..7d7f483 100644 --- a/tool/lib/leakchecker.rb +++ b/tool/lib/leakchecker.rb @@ -7,6 +7,7 @@ class LeakChecker https://github.com/ruby/ruby/blob/trunk/tool/lib/leakchecker.rb#L7 @env_info = find_env @encoding_info = find_encodings @old_verbose = $VERBOSE + @old_warning_flags = find_warning_flags end def check(test_name) @@ -17,6 +18,7 @@ class LeakChecker https://github.com/ruby/ruby/blob/trunk/tool/lib/leakchecker.rb#L18 check_env(test_name), check_encodings(test_name), check_verbose(test_name), + check_warning_flags(test_name), ] GC.start if leaks.any? end @@ -230,6 +232,26 @@ class LeakChecker https://github.com/ruby/ruby/blob/trunk/tool/lib/leakchecker.rb#L232 return leaked 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) output = MiniTest::Unit.output if defined?(output.set_encoding) -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/