mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
test_dir.rb: assert_entries
* test/ruby/test_dir.rb (assert_entries): extract common assertinos for Dir.entries and Dir#foreach. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a4c92d0559
commit
c6411c6455
1 changed files with 7 additions and 3 deletions
|
@ -178,13 +178,17 @@ class TestDir < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
def assert_entries(entries)
|
||||
entries.sort!
|
||||
assert_equal(%w(. ..) + (?a..?z).to_a, entries)
|
||||
end
|
||||
|
||||
def test_entries
|
||||
entries = Dir.open(@root) {|dir| dir.entries}
|
||||
assert_equal(%w(. ..) + (?a..?z).to_a, entries.sort)
|
||||
assert_entries(Dir.open(@root) {|dir| dir.entries})
|
||||
end
|
||||
|
||||
def test_foreach
|
||||
assert_equal(%w(. ..) + (?a..?z).to_a, Dir.foreach(@root).to_a.sort)
|
||||
assert_entries(Dir.foreach(@root).to_a)
|
||||
end
|
||||
|
||||
def test_dir_enc
|
||||
|
|
Loading…
Add table
Reference in a new issue