summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-25 20:54:54 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-25 20:54:54 +0000
commitad859f3125e408beb6a8fedf68cff59c469b150a (patch)
tree5126f322ccd0a9485ff578a5c6d8f1de28b32daa /test
parent7f6ef1f3d6fbf17801be8ab1111bfdf7208a616c (diff)
envutil.rb: encoding
* test/ruby/envutil.rb (Test::Unit::Assertions#assert_separately): specify the encoding of source. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42175 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/envutil.rb5
-rw-r--r--test/ruby/test_require.rb11
2 files changed, 11 insertions, 5 deletions
diff --git a/test/ruby/envutil.rb b/test/ruby/envutil.rb
index 57d2d11f6bf..41ba7ecf1b1 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 77b2a6fbf43..03519392161 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