diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/envutil.rb | 5 | ||||
-rw-r--r-- | test/ruby/test_require.rb | 11 |
2 files changed, 11 insertions, 5 deletions
diff --git a/test/ruby/envutil.rb b/test/ruby/envutil.rb index 57d2d11f6b..41ba7ecf1b 100644 --- a/test/ruby/envutil.rb +++ b/test/ruby/envutil.rb @@ -285,8 +285,11 @@ module Test file ||= loc.path line ||= loc.lineno end + line -= 2 src = <<eom - require #{__dir__.dump}'/envutil';include Test::Unit::Assertions;begin;#{src} +# -*- coding: #{src.encoding}; -*- + require #{__dir__.dump}'/envutil';include Test::Unit::Assertions;begin +#{src} ensure puts [Marshal.dump($!)].pack('m'), "assertions=\#{self._assertions}" end diff --git a/test/ruby/test_require.rb b/test/ruby/test_require.rb index 77b2a6fbf4..0351939216 100644 --- a/test/ruby/test_require.rb +++ b/test/ruby/test_require.rb @@ -71,13 +71,16 @@ class TestRequire < Test::Unit::TestCase end Dir.mkdir(File.dirname(require_path)) open(require_path, "wb") {} - assert_in_out_err([], <<-INPUT, %w(:ok), [], bug8165) - # coding: #{encoding} + assert_separately(%w[--disable=gems], <<-INPUT) # leave paths for require encoding objects + bug = "#{bug8165} require #{encoding} path" + path = "#{require_path}" enc_path = Regexp.new(Regexp.escape(RUBY_PLATFORM)) $:.replace([IO::NULL] + $:.reject {|path| enc_path !~ path}) - p :ok if require '#{require_path}' - p :ng if require '#{require_path}' + assert_nothing_raised(LoadError, bug) { + assert(require(path), bug) + assert(!require(path), bug) + } INPUT } end |