Fix for {} patterns that have last element empty (Closes #65)
This commit is contained in:
parent
6c7fd0291a
commit
8b0d10b94b
@ -121,7 +121,7 @@ module FakeFS
|
|||||||
directories_under(dir)
|
directories_under(dir)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
regexp_pattern = /\A#{pattern.gsub('?','.').gsub('*', '.*').gsub(/\{(.*?)\}/) { "(#{$1.split(',').join('|')})" }}\Z/
|
regexp_pattern = /\A#{pattern.gsub('?','.').gsub('*', '.*').gsub(/\{(.*?)\}/) { "(#{$1.gsub(',', '|')})" }}\Z/
|
||||||
dir.reject {|k,v| regexp_pattern !~ k }.values
|
dir.reject {|k,v| regexp_pattern !~ k }.values
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -575,6 +575,8 @@ class FakeFSTest < Test::Unit::TestCase
|
|||||||
assert_equal %w( /otherpath/foo /otherpath/foobar /path/foo /path/foobar ), Dir['/*/foo*']
|
assert_equal %w( /otherpath/foo /otherpath/foobar /path/foo /path/foobar ), Dir['/*/foo*']
|
||||||
|
|
||||||
assert_equal ['/path/bar', '/path/foo'], Dir['/path/{foo,bar}']
|
assert_equal ['/path/bar', '/path/foo'], Dir['/path/{foo,bar}']
|
||||||
|
|
||||||
|
assert_equal ['/path/bar', '/path/bar2'], Dir['/path/bar{2,}']
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_dir_glob_handles_root
|
def test_dir_glob_handles_root
|
||||||
|
Loading…
Reference in New Issue
Block a user