mirror of
https://github.com/ruby/ruby.git
synced 2025-08-26 14:34:39 +02:00
Dir.glob base option
* dir.c (dir_s_aref, dir_s_glob): add new optional keyword argument, `base`. [Feature#13056] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58858 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
2ba68008b5
commit
52419a6e10
3 changed files with 67 additions and 21 deletions
|
@ -202,6 +202,12 @@ class TestDir < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
def test_glob_base
|
||||
files = %w[a/foo.c c/bar.c].map {|n| File.join(@root, n)}
|
||||
files.each {|n| File.write(n, "")}
|
||||
assert_equal(files, Dir.glob("*/*.c", base: @root))
|
||||
end
|
||||
|
||||
def assert_entries(entries)
|
||||
entries.sort!
|
||||
assert_equal(%w(. ..) + ("a".."z").to_a, entries)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue