summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2023-09-13 19:00:32 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2023-09-18 09:55:07 +0900
commit5c6e00b090a81d233ccff98e0d642e7dd0182bd0 (patch)
treeec5bdd03ac4178cdbd7b7c4122bbc27632be2bd5 /test/ruby
parent8b4e54f9792769efd69028d19eb631cdf5fc60d9 (diff)
Simplify restoring ENV
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_rubyoptions.rb9
1 files changed, 2 insertions, 7 deletions
diff --git a/test/ruby/test_rubyoptions.rb b/test/ruby/test_rubyoptions.rb
index 20fa15604d..d174bda50f 100644
--- a/test/ruby/test_rubyoptions.rb
+++ b/test/ruby/test_rubyoptions.rb
@@ -99,8 +99,7 @@ class TestRubyOptions < Test::Unit::TestCase
end
def test_warning
- save_rubyopt = ENV['RUBYOPT']
- ENV['RUBYOPT'] = nil
+ save_rubyopt = ENV.delete('RUBYOPT')
assert_in_out_err(%w(-W0 -e) + ['p $-W'], "", %w(0), [])
assert_in_out_err(%w(-W1 -e) + ['p $-W'], "", %w(1), [])
assert_in_out_err(%w(-Wx -e) + ['p $-W'], "", %w(2), [])
@@ -418,11 +417,7 @@ class TestRubyOptions < Test::Unit::TestCase
ENV['RUBYOPT'] = '-W:qux'
assert_in_out_err(%w(), "", [], /unknown warning category: `qux'/)
ensure
- if rubyopt_orig
- ENV['RUBYOPT'] = rubyopt_orig
- else
- ENV.delete('RUBYOPT')
- end
+ ENV['RUBYOPT'] = rubyopt_orig
end
def test_search