From b09ff06845267dce70c8b7868a68ae88acd54af2 Mon Sep 17 00:00:00 2001 From: naruse Date: Sun, 22 Oct 2017 02:03:49 +0000 Subject: Dir.glob with FNM_EXTGLOB is optimized [Feature #13873] The order of resulted array is changed in some cases. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60341 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_dir.rb | 2 +- test/ruby/test_fnmatch.rb | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'test/ruby') diff --git a/test/ruby/test_dir.rb b/test/ruby/test_dir.rb index cead4beb93..f12fd13c58 100644 --- a/test/ruby/test_dir.rb +++ b/test/ruby/test_dir.rb @@ -155,7 +155,7 @@ class TestDir < Test::Unit::TestCase open(File.join(@root, "}}{}"), "wb") {} open(File.join(@root, "}}a"), "wb") {} assert_equal(%w(}}{} }}a).map {|f| File.join(@root, f)}, Dir.glob(File.join(@root, '}}{\{\},a}'))) - assert_equal(%w(}}{} }}a b c).map {|f| File.join(@root, f)}, Dir.glob(File.join(@root, '{\}\}{\{\},a},b,c}'))) + assert_equal(%w(}}{} }}a b c).map {|f| File.join(@root, f)}.sort, Dir.glob(File.join(@root, '{\}\}{\{\},a},b,c}')).sort) end def test_glob_recursive diff --git a/test/ruby/test_fnmatch.rb b/test/ruby/test_fnmatch.rb index ca01a28698..2fb8796ab3 100644 --- a/test/ruby/test_fnmatch.rb +++ b/test/ruby/test_fnmatch.rb @@ -108,6 +108,10 @@ class TestFnmatch < Test::Unit::TestCase feature5422 = '[ruby-core:40037]' assert_file.for(feature5422).not_fnmatch?( "{.g,t}*", ".gem") assert_file.for(feature5422).fnmatch?("{.g,t}*", ".gem", File::FNM_EXTGLOB) + + assert_file.fnmatch?("{,.}*", ".gem", File::FNM_EXTGLOB) + assert_file.not_fnmatch?("{}*", ".gem", File::FNM_EXTGLOB) + assert_file.not_fnmatch?("{.}*", ".gem") end def test_unmatched_encoding -- cgit v1.2.3