mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
test_require.rb: split
* test/ruby/test_require.rb (TestRequire#test_require_nonascii_path): split test body. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42182 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
f375a8b40e
commit
2c181b6d1a
1 changed files with 6 additions and 2 deletions
|
@ -61,8 +61,12 @@ class TestRequire < Test::Unit::TestCase
|
||||||
|
|
||||||
def test_require_nonascii_path
|
def test_require_nonascii_path
|
||||||
bug8165 = '[ruby-core:53733] [Bug #8165]'
|
bug8165 = '[ruby-core:53733] [Bug #8165]'
|
||||||
|
encoding = /mswin|mingw/ =~ RUBY_PLATFORM ? 'filesystem' : 'UTF-8'
|
||||||
|
assert_require_nonascii_path(encoding, bug8165)
|
||||||
|
end
|
||||||
|
|
||||||
|
def assert_require_nonascii_path(encoding, bug)
|
||||||
Dir.mktmpdir {|tmp|
|
Dir.mktmpdir {|tmp|
|
||||||
encoding = /mswin|mingw/ =~ RUBY_PLATFORM ? 'filesystem' : 'UTF-8'
|
|
||||||
dir = "\u3042" * 5
|
dir = "\u3042" * 5
|
||||||
begin
|
begin
|
||||||
require_path = File.join(tmp, dir, 'foo.rb').encode(encoding)
|
require_path = File.join(tmp, dir, 'foo.rb').encode(encoding)
|
||||||
|
@ -73,7 +77,7 @@ class TestRequire < Test::Unit::TestCase
|
||||||
open(require_path, "wb") {}
|
open(require_path, "wb") {}
|
||||||
assert_separately(%w[--disable=gems], <<-INPUT)
|
assert_separately(%w[--disable=gems], <<-INPUT)
|
||||||
# leave paths for require encoding objects
|
# leave paths for require encoding objects
|
||||||
bug = "#{bug8165} require #{encoding} path"
|
bug = "#{bug} require #{encoding} path"
|
||||||
require_path = "#{require_path}"
|
require_path = "#{require_path}"
|
||||||
enc_path = Regexp.new(Regexp.escape(RUBY_PLATFORM))
|
enc_path = Regexp.new(Regexp.escape(RUBY_PLATFORM))
|
||||||
$:.replace([IO::NULL] + $:.reject {|path| enc_path !~ path})
|
$:.replace([IO::NULL] + $:.reject {|path| enc_path !~ path})
|
||||||
|
|
Loading…
Reference in a new issue