mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
7f6ef1f3d6
commit
ad859f3125
2 changed files with 11 additions and 5 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue