1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Consider environment variable case-insensitiveness

This commit is contained in:
Nobuyoshi Nakada 2021-11-28 21:49:03 +09:00
parent 1db066186b
commit 4acc7563a1
Notes: git 2021-11-29 23:00:50 +09:00

View file

@ -209,13 +209,28 @@ class LeakChecker
return leaked
end
def find_env
ENV.to_h
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
ENV.to_h
end
end
def check_env(test_name)
old_env = @env_info
new_env = ENV.to_h
new_env = find_env
return false if old_env == new_env
(old_env.keys | new_env.keys).sort.each {|k|
if old_env.has_key?(k)