diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-10-16 01:54:05 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-10-16 01:54:05 +0000 |
commit | 7b4f0c0d1d4815807b000506cb470eb925834f9d (patch) | |
tree | f44dbeb0f29d7e3ec26412f5484eab6013139377 /test/ruby/test_file_exhaustive.rb | |
parent | ad54de2acac70ba2f889892df950508edbc972b7 (diff) | |
download | ruby-7b4f0c0d1d4815807b000506cb470eb925834f9d.tar.gz |
file.c: ASCII-compatible
* file.c (rb_file_join): path names must be ASCII-compatible.
[ruby-core:48012] [Bug #7168]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37207 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_file_exhaustive.rb')
-rw-r--r-- | test/ruby/test_file_exhaustive.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_file_exhaustive.rb b/test/ruby/test_file_exhaustive.rb index e13c98c44a..f697488192 100644 --- a/test/ruby/test_file_exhaustive.rb +++ b/test/ruby/test_file_exhaustive.rb @@ -772,10 +772,14 @@ class TestFileExhaustive < Test::Unit::TestCase s = "foo" + File::SEPARATOR + "bar" + File::SEPARATOR + "baz" assert_equal(s, File.join("foo", "bar", "baz")) assert_equal(s, File.join(["foo", "bar", "baz"])) + o = Object.new def o.to_path; "foo"; end assert_equal(s, File.join(o, "bar", "baz")) assert_equal(s, File.join("foo" + File::SEPARATOR, "bar", File::SEPARATOR + "baz")) + end + + def test_join_alt_separator if File::ALT_SEPARATOR == '\\' a = "\225\\" b = "foo" @@ -785,6 +789,12 @@ class TestFileExhaustive < Test::Unit::TestCase end end + def test_join_ascii_incompatible + bug7168 = '[ruby-core:48012]' + names = %w"a b".map {|s| s.encode(Encoding::UTF_16LE)} + assert_raise(Encoding::CompatibilityError, bug7168) {File.join(*names)} + end + def test_truncate assert_equal(0, File.truncate(@file, 1)) file_assertion.exist?(@file) |