1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/test/-ext-/win32/test_dln.rb
shirosaki ff6573b696 test_dln.rb: fix path separator on MinGW
* test/-ext-/win32/test_dln.rb (TestDln#test_check_imported):
  RbConfig::CONFIG["PATH_SEPARATOR"] is : which is a separator on
  msys2 shell building ruby. Use File::PATH_SEPARATOR ; on test.
  [Bug #13642] [ruby-core:81623]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60056 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-28 13:55:48 +00:00

39 lines
1.4 KiB
Ruby

# frozen_string_literal: false
require 'test/unit'
require 'tmpdir'
require 'rbconfig'
module Bug
module Win32
class TestDln < Test::Unit::TestCase
def test_check_imported
bug = '[Bug #6303]'
so = ::File.expand_path("../ext/-test-/win32/dln/dlntest.dll", ::EnvUtil.rubybin)
assert_send([::File, :file?, so])
path = ::ENV['PATH']
path = ::File.dirname(so) + ::File::PATH_SEPARATOR + path
assert_in_out_err([{'PATH'=>path}, '-r-test-/win32/dln', '-eexit'], '', [], [], bug, timeout: 10)
end
def test_nonascii_load
bug9699 = '[ruby-core:61845] [Bug #9699]'
so = "-test-/dln/empty." + ::RbConfig::CONFIG["DLEXT"]
so = $:.find {|d| d = ::File.join(d, so); break d if ::File.exist?(d)}
assert_not_nil(so)
::Dir.mkdir(dir = ::File.join(testdir = ::Dir.mktmpdir("test"), "\u{30c6 30b9 30c8}"))
::File.copy_stream(so, ::File.join(dir, ::File.basename(so)))
assert_separately(['-', bug9699, testdir, ::File.basename(so)], <<-'end;')
bug, dir, so = *ARGV
assert_nothing_raised(LoadError, bug) do
require ::File.join(dir, "\u{30c6 30b9 30c8}", so)
end
end;
ensure
::File.unlink(::File.join(dir, ::File.basename(so))) rescue nil
::Dir.rmdir(dir) rescue nil
::Dir.rmdir(testdir) rescue nil
end
end
end
end if /mswin|mingw/ =~ RUBY_PLATFORM