summaryrefslogtreecommitdiff
path: root/test/pathname
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-21 08:34:49 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-21 08:34:49 +0000
commitcea5f5aaee52ef756a6f7c200b0b37f9c63c01c0 (patch)
tree382290807df64dd418a43e99c5d53e8f9938958c /test/pathname
parent2caaae0707ce0ed9920512f54329ae8e4a0c1018 (diff)
Pathname#glob method implemented.
[ruby-core:49373] [Feature #7360] proposed by Alexander E. Fischer. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/pathname')
-rw-r--r--test/pathname/test_pathname.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/pathname/test_pathname.rb b/test/pathname/test_pathname.rb
index 1efd401..d0c2aa1 100644
--- a/test/pathname/test_pathname.rb
+++ b/test/pathname/test_pathname.rb
@@ -1250,6 +1250,19 @@ class TestPathname < Test::Unit::TestCase
assert_kind_of(Pathname, wd)
end
+ def test_glob
+ with_tmpchdir('rubytest-pathname') {|dir|
+ Dir.mkdir("d")
+ open("d/f", "w") {|f| f.write "abc" }
+ Dir.mkdir("d/e")
+ assert_equal([Pathname("d/e"), Pathname("d/f")], Pathname("d").glob("*").sort)
+ a = []
+ Pathname("d").glob("*") {|path| a << path }
+ a.sort!
+ assert_equal([Pathname("d/e"), Pathname("d/f")], a)
+ }
+ end
+
def test_entries
with_tmpchdir('rubytest-pathname') {|dir|
open("a", "w") {}