aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_fnmatch.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_fnmatch.rb')
-rw-r--r--test/ruby/test_fnmatch.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/ruby/test_fnmatch.rb b/test/ruby/test_fnmatch.rb
index d186638a7b..0b3f604df5 100644
--- a/test/ruby/test_fnmatch.rb
+++ b/test/ruby/test_fnmatch.rb
@@ -109,4 +109,19 @@ class TestFnmatch < Test::Unit::TestCase
assert_file.for(feature5422).not_fnmatch?( "{.g,t}*", ".gem")
assert_file.for(feature5422).fnmatch?("{.g,t}*", ".gem", File::FNM_EXTGLOB)
end
+
+ def test_unmatched_encoding
+ bug7911 = '[ruby-dev:47069] [Bug #7911]'
+ path = "\u{3042}"
+ pattern_ascii = 'a'.encode('US-ASCII')
+ pattern_eucjp = path.encode('EUC-JP')
+ assert_nothing_raised(ArgumentError, bug7911) do
+ assert(!File.fnmatch(pattern_ascii, path))
+ assert(!File.fnmatch(pattern_eucjp, path))
+ assert(!File.fnmatch(pattern_ascii, path, File::FNM_CASEFOLD))
+ assert(!File.fnmatch(pattern_eucjp, path, File::FNM_CASEFOLD))
+ assert(File.fnmatch("{*,#{pattern_ascii}}", path, File::FNM_EXTGLOB))
+ assert(File.fnmatch("{*,#{pattern_eucjp}}", path, File::FNM_EXTGLOB))
+ end
+ end
end