From 310ab79f5392f102ab0ef0434c8e25f203f9a287 Mon Sep 17 00:00:00 2001 From: naruse Date: Fri, 20 Feb 2015 08:59:19 +0000 Subject: merge revision(s) 49532: dir.c: fix escaping multibyte char * dir.c (has_magic): fix escaping multibyte char, with glob meta-char in trailing bytes, e.g., Shift-JIS git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@49667 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_dir_m17n.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_dir_m17n.rb b/test/ruby/test_dir_m17n.rb index 325b1571c9..143bf52afb 100644 --- a/test/ruby/test_dir_m17n.rb +++ b/test/ruby/test_dir_m17n.rb @@ -347,6 +347,16 @@ class TestDir_M17N < Test::Unit::TestCase end end + def test_glob_escape_multibyte + name = "\x81\\".force_encoding(Encoding::Shift_JIS) + with_tmpdir do + open(name, "w") {} rescue next + match, = Dir.glob("#{name}*") + next unless match and match.encoding == Encoding::Shift_JIS + assert_equal([name], Dir.glob("\\#{name}*")) + end + end + def test_entries_compose bug7267 = '[ruby-core:48745] [Bug #7267]' -- cgit v1.2.3