[前][次][番号順一覧][スレッド一覧]

ruby-changes:41787

From: nobu <ko1@a...>
Date: Thu, 18 Feb 2016 00:13:38 +0900 (JST)
Subject: [ruby-changes:41787] nobu:r53861 (trunk): test_dir.rb: Dir.empty? with dot file

nobu	2016-02-18 00:14:03 +0900 (Thu, 18 Feb 2016)

  New Revision: 53861

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=53861

  Log:
    test_dir.rb: Dir.empty? with dot file
    
    * test/ruby/test_dir.rb (test_empty): check with a dot file.

  Modified files:
    trunk/test/ruby/test_dir.rb
Index: test/ruby/test_dir.rb
===================================================================
--- test/ruby/test_dir.rb	(revision 53860)
+++ test/ruby/test_dir.rb	(revision 53861)
@@ -334,15 +334,14 @@ class TestDir < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_dir.rb#L334
 
   def test_empty?
     assert_not_send([Dir, :empty?, @root])
-    assert_send([Dir, :empty?, File.join(@root, "a")])
-    tmp = File.join(@root, "a", "A")
-    open(tmp, "w") {}
-    assert_not_send([Dir, :empty?, File.join(@root, "a")])
-    File.delete(tmp)
-    assert_send([Dir, :empty?, File.join(@root, "a")])
-    unless /mswin|mingw|cygwin/ =~ RUBY_PLATFORM
-      open(File.join(@root, "a", "..."), "w") {}
-      assert_not_send([Dir, :empty?, File.join(@root, "a")])
+    a = File.join(@root, "a")
+    assert_send([Dir, :empty?, a])
+    %w[A .dot].each do |tmp|
+      tmp = File.join(a, tmp)
+      open(tmp, "w") {}
+      assert_not_send([Dir, :empty?, a])
+      File.delete(tmp)
+      assert_send([Dir, :empty?, a])
     end
     assert_raise(Errno::ENOENT) {Dir.empty?(@nodir)}
     assert_not_send([Dir, :empty?, File.join(@root, "b")])

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]