summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-05-23 13:47:36 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-05-23 13:47:36 +0000
commit52419a6e1032c4fe8fe6f6f6e2858dcd8fa32ba6 (patch)
treeef124e40608ebc586a0aca52f0117624bb8c88ed /test
parent2ba68008b593e1ef064dd8eeea03492ba4c4f3ff (diff)
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
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_dir.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ruby/test_dir.rb b/test/ruby/test_dir.rb
index 553f1aef63..d3fd1be2ec 100644
--- a/test/ruby/test_dir.rb
+++ b/test/ruby/test_dir.rb
@@ -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)