From 342fbae83c2e80d1b49656bc7c689cc7fe8980ce Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Sat, 24 Oct 2020 15:52:35 +0200 Subject: [PATCH] Update to ruby/mspec@b56e7a2 --- .../lib/mspec/runner/actions/leakchecker.rb | 17 ++++++++++++++++- spec/mspec/lib/mspec/utils/warnings.rb | 1 - 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/spec/mspec/lib/mspec/runner/actions/leakchecker.rb b/spec/mspec/lib/mspec/runner/actions/leakchecker.rb index 9efabc79b4..596b120d9f 100644 --- a/spec/mspec/lib/mspec/runner/actions/leakchecker.rb +++ b/spec/mspec/lib/mspec/runner/actions/leakchecker.rb @@ -36,6 +36,7 @@ class LeakChecker @thread_info = find_threads @env_info = find_env @argv_info = find_argv + @globals_info = find_globals @encoding_info = find_encodings end @@ -48,9 +49,10 @@ class LeakChecker check_process_leak check_env check_argv + check_globals check_encodings check_tracepoints - GC.start if !@leaks.empty? + GC.start unless @leaks.empty? @leaks.empty? end @@ -244,6 +246,19 @@ class LeakChecker end end + def find_globals + { verbose: $VERBOSE, debug: $DEBUG } + end + + def check_globals + old_globals = @globals_info + new_globals = find_globals + if new_globals != old_globals + leak "Globals changed: #{old_globals.inspect} to #{new_globals.inspect}" + @globals_info = new_globals + end + end + def find_encodings [Encoding.default_internal, Encoding.default_external] end diff --git a/spec/mspec/lib/mspec/utils/warnings.rb b/spec/mspec/lib/mspec/utils/warnings.rb index 1cd9153a37..288dbe71aa 100644 --- a/spec/mspec/lib/mspec/utils/warnings.rb +++ b/spec/mspec/lib/mspec/utils/warnings.rb @@ -45,7 +45,6 @@ if Object.const_defined?(:Warning) and Warning.respond_to?(:warn) when /\/(argf|io|stringio)\/.+(ARGF|IO)#(lines|chars|bytes|codepoints) is deprecated/ when /Thread\.exclusive is deprecated.+\n.+thread\/exclusive_spec\.rb/ when /hash\/shared\/index\.rb:\d+: warning: Hash#index is deprecated; use Hash#key/ - when /env\/shared\/key\.rb:\d+: warning: ENV\.index is deprecated; use ENV\.key/ when /exponent(_spec)?\.rb:\d+: warning: in a\*\*b, b may be too big/ when /enumerator\/(new_spec|initialize_spec)\.rb:\d+: warning: Enumerator\.new without a block is deprecated/ when /Pattern matching is experimental, and the behavior may change in future versions of Ruby!/