ruby-changes:38058
From: nobu <ko1@a...>
Date: Tue, 31 Mar 2015 17:10:01 +0900 (JST)
Subject: [ruby-changes:38058] nobu:r50139 (trunk): test_dir.rb: assert_entries
nobu 2015-03-31 17:09:34 +0900 (Tue, 31 Mar 2015) New Revision: 50139 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=50139 Log: test_dir.rb: assert_entries * test/ruby/test_dir.rb (assert_entries): extract common assertinos for Dir.entries and Dir#foreach. Modified files: trunk/test/ruby/test_dir.rb Index: test/ruby/test_dir.rb =================================================================== --- test/ruby/test_dir.rb (revision 50138) +++ test/ruby/test_dir.rb (revision 50139) @@ -178,13 +178,17 @@ class TestDir < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_dir.rb#L178 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/