diff options
| author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2021-11-28 21:49:03 +0900 |
|---|---|---|
| committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2021-11-29 23:00:20 +0900 |
| commit | 4acc7563a111fd35524b07150990dc3ef842a685 (patch) | |
| tree | feeaf47bd544c24b348a83adfec4f504ad1c062e /tool | |
| parent | 1db066186b7a929c18f031d0c8416140f3c0fcda (diff) | |
Consider environment variable case-insensitiveness
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/5188
Diffstat (limited to 'tool')
| -rw-r--r-- | tool/lib/leakchecker.rb | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/tool/lib/leakchecker.rb b/tool/lib/leakchecker.rb index 052bea5e53..ed50796940 100644 --- a/tool/lib/leakchecker.rb +++ b/tool/lib/leakchecker.rb @@ -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) |
