diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-11-15 16:24:45 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-11-15 16:24:45 +0000 |
commit | 43bd807c43d25b31b29c6225b7d0f8ca6e67e40d (patch) | |
tree | b16ffaef11ff4b996c06bc0c21b8960e9c313066 /test/ruby/test_dir_m17n.rb | |
parent | f5936bc8351bda72ee852456c4565384969fe688 (diff) | |
download | ruby-43bd807c43d25b31b29c6225b7d0f8ca6e67e40d.tar.gz |
add tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25780 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_dir_m17n.rb')
-rw-r--r-- | test/ruby/test_dir_m17n.rb | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/test/ruby/test_dir_m17n.rb b/test/ruby/test_dir_m17n.rb new file mode 100644 index 0000000000..852f093006 --- /dev/null +++ b/test/ruby/test_dir_m17n.rb @@ -0,0 +1,49 @@ +require 'test/unit' +require 'tmpdir' +require_relative 'envutil' + +class TestDir_M17N < Test::Unit::TestCase + def with_tmpdir + Dir.mktmpdir {|dir| + Dir.chdir(dir) { + yield dir + } + } + end + + def test_filename_bytes_euc_jp + with_tmpdir {|d| + assert_in_out(%w[-EEUC-JP], <<-'EOS', %w[true], nil, :chdir=>d) + filename = "\xA4\xA2".force_encoding("euc-jp") + File.open(filename, "w") {} + ents = Dir.entries(".") + ents.each {|e| e.force_encoding("ASCII-8BIT") } + p ents.include?(filename.force_encoding("ASCII-8BIT")) + EOS + } + end + + def test_filename_euc_jp + with_tmpdir {|d| + assert_in_out(%w[-EEUC-JP], <<-'EOS', %w[true], nil, :chdir=>d) + filename = "\xA4\xA2".force_encoding("euc-jp") + File.open(filename, "w") {} + ents = Dir.entries(".") + p ents.include?(filename) + EOS + } + end + + def test_filename_utf_8 + with_tmpdir {|d| + assert_in_out(%w[-EUTF-8], <<-'EOS', %w[true], nil, :chdir=>d) + filename = "\u3042".force_encoding("utf-8") + File.open(filename, "w") {} + ents = Dir.entries(".") + p ents.include?(filename) + EOS + } + end + +end + |