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

ruby-changes:32121

From: nobu <ko1@a...>
Date: Sat, 14 Dec 2013 13:17:09 +0900 (JST)
Subject: [ruby-changes:32121] nobu:r44200 (trunk): Additional test coverage to Dir class. Dir['**/*'] should not resolve symlinks.

nobu	2013-12-14 13:17:04 +0900 (Sat, 14 Dec 2013)

  New Revision: 44200

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=44200

  Log:
    Additional test coverage to Dir class. Dir['**/*'] should not resolve symlinks.

  Modified files:
    trunk/test/ruby/test_dir.rb
Index: test/ruby/test_dir.rb
===================================================================
--- test/ruby/test_dir.rb	(revision 44199)
+++ test/ruby/test_dir.rb	(revision 44200)
@@ -249,4 +249,16 @@ class TestDir < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_dir.rb#L249
     ENV["LOGDIR"] = env_logdir
   end
 
+  def test_symlinks_not_resolved
+    Dir.mktmpdir do |dirname|
+      Dir.chdir(dirname) do
+        Dir.mkdir('some-dir')
+        File.write('some-dir/foo', 'some content')
+        File.symlink('some-dir', 'dir-symlink')
+
+        assert_equal [ 'dir-symlink', 'some-dir' ], Dir['*'].sort
+        assert_equal [ 'dir-symlink', 'some-dir', 'some-dir/foo' ], Dir['**/*'].sort
+      end
+    end
+  end
 end

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

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