diff options
author | Benoit Daloze <[email protected]> | 2020-10-24 15:52:35 +0200 |
---|---|---|
committer | Benoit Daloze <[email protected]> | 2020-10-24 15:53:53 +0200 |
commit | 342fbae83c2e80d1b49656bc7c689cc7fe8980ce (patch) | |
tree | 3ad1c53eab8d90a6358ee6ca7c23b261ad52e745 /spec/mspec/lib | |
parent | 1388257d7aa0309f14967e4804b9fe8ba9f68ee8 (diff) |
Update to ruby/mspec@b56e7a2
Diffstat (limited to 'spec/mspec/lib')
-rw-r--r-- | spec/mspec/lib/mspec/runner/actions/leakchecker.rb | 17 | ||||
-rw-r--r-- | 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 [email protected]? + 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!/ |