summaryrefslogtreecommitdiff
path: root/test/fiddle/test_import.rb
diff options
context:
space:
mode:
authorSutou Kouhei <kou@clear-code.com>2019-05-28 06:04:19 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2019-10-24 19:34:29 +0900
commit4d844cbaed518743776594fa5ae33b86fe176ad1 (patch)
treedd3c6433b7ee514892bfb85705c78073e532a289 /test/fiddle/test_import.rb
parent5ebb0d50f6560b35bc03deb79341a115c5f782ee (diff)
[ruby/fiddle] test: use env Hash
https://github.com/ruby/fiddle/commit/a01a962342
Diffstat (limited to 'test/fiddle/test_import.rb')
-rw-r--r--test/fiddle/test_import.rb23
1 files changed, 13 insertions, 10 deletions
diff --git a/test/fiddle/test_import.rb b/test/fiddle/test_import.rb
index e243105568..3170e9e4df 100644
--- a/test/fiddle/test_import.rb
+++ b/test/fiddle/test_import.rb
@@ -149,18 +149,21 @@ module Fiddle
end
def test_no_message_with_debug
- # disable all Ruby environment variables
- orig_RUBYOPT, ENV['RUBYOPT'] = ENV['RUBYOPT'], nil
- orig_RUBYLIB, ENV['RUBYLIB'] = ENV['RUBYLIB'], nil
-
# load development fiddle instead of bundled one
libdir = File.expand_path('../../../lib', __FILE__)
- ENV['RUBYLIB'] = libdir if File.file?(File.join(libdir, "fiddle/import.rb"))
-
- assert_in_out_err(%w[--debug --disable=gems -rfiddle/import], 'p Fiddle::Importer', ['Fiddle::Importer'])
- ensure
- ENV['RUBYLIB'] = orig_RUBYLIB
- ENV['RUBYOPT'] = orig_RUBYOPT
+ libdir = nil unless File.file?(File.join(libdir, "fiddle/import.rb"))
+ assert_in_out_err([
+ # disable all Ruby environment variables
+ {
+ "RUBYOPT" => nil,
+ "RUBYLIB" => libdir,
+ },
+ "--debug",
+ "--disable=gems",
+ "-rfiddle/import",
+ ],
+ 'p Fiddle::Importer',
+ ['Fiddle::Importer'])
end
end
end if defined?(Fiddle)