1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* dir.c (GlobPathValue), file.c (rb_get_path_check): path names

must be ASCII compatible.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25007 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2009-09-19 08:33:01 +00:00
parent bdde51172c
commit a1485dbea0
5 changed files with 29 additions and 1 deletions

View file

@ -3,6 +3,13 @@ require "fileutils"
require "tmpdir"
class TestFileExhaustive < Test::Unit::TestCase
def assert_incompatible_encoding
d = "\u{3042}\u{3044}".encode("utf-16le")
assert_raise(Encoding::CompatibilityError) {yield d}
m = Class.new {define_method(:to_path) {d}}
assert_raise(Encoding::CompatibilityError) {yield m.new}
end
def setup
@dir = Dir.mktmpdir("rubytest-file")
File.chown(-1, Process.gid, @dir)
@ -388,6 +395,8 @@ class TestFileExhaustive < Test::Unit::TestCase
assert_kind_of(String, File.expand_path("~"))
assert_raise(ArgumentError) { File.expand_path("~foo_bar_baz_unknown_user_wahaha") }
assert_raise(ArgumentError) { File.expand_path("~foo_bar_baz_unknown_user_wahaha", "/") }
assert_incompatible_encoding {|d| File.expand_path(d)}
end
def test_basename
@ -412,11 +421,14 @@ class TestFileExhaustive < Test::Unit::TestCase
assert_equal(basename, File.basename(@file + ".", ".*"))
assert_equal(basename, File.basename(@file + "::$DATA", ".*"))
end
assert_incompatible_encoding {|d| File.basename(d)}
end
def test_dirname
assert(@file.start_with?(File.dirname(@file)))
assert_equal(".", File.dirname(""))
assert_incompatible_encoding {|d| File.dirname(d)}
end
def test_extname
@ -440,6 +452,8 @@ class TestFileExhaustive < Test::Unit::TestCase
end
end
end
assert_incompatible_encoding {|d| File.extname(d)}
end
def test_split