summaryrefslogtreecommitdiff
path: root/test/pathname
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2021-09-17 12:12:08 -0700
committergit <svn-admin@ruby-lang.org>2022-01-07 09:42:09 +0900
commitdd6a75195a635abfcfdb8ac5df26885e91708908 (patch)
treeef600f941f1bbab71399bead7917c4dd7d9cef19 /test/pathname
parent6baa78bb78315dfb0bc05e933fe6c512a3a098e6 (diff)
downloadruby-dd6a75195a635abfcfdb8ac5df26885e91708908.tar.gz
[ruby/pathname] Make Pathname#each_entry return enumerator if called without block
Fixes [Bug #18158] https://github.com/ruby/pathname/commit/914c726aa2
Diffstat (limited to 'test/pathname')
-rw-r--r--test/pathname/test_pathname.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/pathname/test_pathname.rb b/test/pathname/test_pathname.rb
index 9e14668c99..c971597602 100644
--- a/test/pathname/test_pathname.rb
+++ b/test/pathname/test_pathname.rb
@@ -1355,6 +1355,18 @@ class TestPathname < Test::Unit::TestCase
}
end
+ def test_each_entry_enumerator
+ with_tmpchdir('rubytest-pathname') {|dir|
+ open("a", "w") {}
+ open("b", "w") {}
+ a = []
+ e = Pathname(".").each_entry
+ assert_kind_of(Enumerator, e)
+ e.each {|v| a << v }
+ assert_equal([Pathname("."), Pathname(".."), Pathname("a"), Pathname("b")], a.sort)
+ }
+ end
+
def test_mkdir
with_tmpchdir('rubytest-pathname') {|dir|
Pathname("d").mkdir