summaryrefslogtreecommitdiff
path: root/spec/mspec/lib/mspec/runner/actions/leakchecker.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/mspec/lib/mspec/runner/actions/leakchecker.rb')
-rw-r--r--spec/mspec/lib/mspec/runner/actions/leakchecker.rb17
1 files changed, 16 insertions, 1 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