Consider environment variable case-insensitiveness
This commit is contained in:
parent
1db066186b
commit
4acc7563a1
Notes:
git
2021-11-29 23:00:50 +09:00
@ -209,13 +209,28 @@ class LeakChecker
|
|||||||
return leaked
|
return leaked
|
||||||
end
|
end
|
||||||
|
|
||||||
|
e = ENV["_Ruby_Env_Ignorecase_"], ENV["_RUBY_ENV_IGNORECASE_"]
|
||||||
|
begin
|
||||||
|
ENV["_Ruby_Env_Ignorecase_"] = ENV["_RUBY_ENV_IGNORECASE_"] = nil
|
||||||
|
ENV["_RUBY_ENV_IGNORECASE_"] = "ENV_CASE_TEST"
|
||||||
|
ENV_IGNORECASE = ENV["_Ruby_Env_Ignorecase_"] == "ENV_CASE_TEST"
|
||||||
|
ensure
|
||||||
|
ENV["_Ruby_Env_Ignorecase_"], ENV["_RUBY_ENV_IGNORECASE_"] = e
|
||||||
|
end
|
||||||
|
|
||||||
|
if ENV_IGNORECASE
|
||||||
|
def find_env
|
||||||
|
ENV.to_h {|k, v| [k.upcase, v]}
|
||||||
|
end
|
||||||
|
else
|
||||||
def find_env
|
def find_env
|
||||||
ENV.to_h
|
ENV.to_h
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def check_env(test_name)
|
def check_env(test_name)
|
||||||
old_env = @env_info
|
old_env = @env_info
|
||||||
new_env = ENV.to_h
|
new_env = find_env
|
||||||
return false if old_env == new_env
|
return false if old_env == new_env
|
||||||
(old_env.keys | new_env.keys).sort.each {|k|
|
(old_env.keys | new_env.keys).sort.each {|k|
|
||||||
if old_env.has_key?(k)
|
if old_env.has_key?(k)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user