summaryrefslogtreecommitdiff
path: root/test/fiddle/test_import.rb
diff options
context:
space:
mode:
authorKenta Murata <mrkn@users.noreply.github.com>2019-05-27 18:53:33 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2019-10-24 19:34:22 +0900
commit5ebb0d50f6560b35bc03deb79341a115c5f782ee (patch)
treedf4cd4c3f0d53833b9e52262d38b7d06f1007055 /test/fiddle/test_import.rb
parent7733db665ad07980afcaa5bc3fadebc0128fbdf2 (diff)
[ruby/fiddle] Fix a failing test (#13)
* Fix a failing test This commit fixes the following failure: ``` 1) Failure: Fiddle::TestImport#test_no_message_with_debug [/Users/mrkn/src/github.com/ruby/fiddle/test/fiddle/test_import.rb:152]: 1. [2/2] Assertion for "stderr" | <[]> expected but was | <["Exception `NameError' at /Users/mrkn/.rbenv/versions/2.5.1/lib/ruby/2.5.0/fiddle/import.rb:157 - uninitialized constant Fiddle::Function::STDCALL"]>. ``` * Stop using Bundler.with_clean_env * Clear existing Ruby environment variables on test_no_message_with_debug https://github.com/ruby/fiddle/commit/13133ddec8
Diffstat (limited to 'test/fiddle/test_import.rb')
-rw-r--r--test/fiddle/test_import.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/fiddle/test_import.rb b/test/fiddle/test_import.rb
index 99294ea161..e243105568 100644
--- a/test/fiddle/test_import.rb
+++ b/test/fiddle/test_import.rb
@@ -149,7 +149,18 @@ 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
end
end
end if defined?(Fiddle)