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

ruby-changes:34010

From: hsbt <ko1@a...>
Date: Sun, 25 May 2014 09:58:59 +0900 (JST)
Subject: [ruby-changes:34010] hsbt:r46091 (trunk): * test/fileutils/test_fileutils.rb: Added recursively chmod tests.

hsbt	2014-05-25 09:58:52 +0900 (Sun, 25 May 2014)

  New Revision: 46091

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

  Log:
    * test/fileutils/test_fileutils.rb: Added recursively chmod tests.
      [Feature #9303][ruby-core:59325]

  Modified files:
    trunk/ChangeLog
    trunk/test/fileutils/test_fileutils.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 46090)
+++ ChangeLog	(revision 46091)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sun May 25 09:57:09 2014  SHIBATA Hiroshi  <shibata.hiroshi@g...>
+
+	* test/fileutils/test_fileutils.rb: Added recursively chmod tests.
+	  [Feature #9303][ruby-core:59325]
+
 Sun May 25 09:41:56 2014  Zachary Scott  <e@z...>
 
 	* class.c: [DOC] Fixed grammar and examples of instance_methods.
Index: test/fileutils/test_fileutils.rb
===================================================================
--- test/fileutils/test_fileutils.rb	(revision 46090)
+++ test/fileutils/test_fileutils.rb	(revision 46091)
@@ -1145,6 +1145,24 @@ class TestFileUtils < Test::Unit::TestCa https://github.com/ruby/ruby/blob/trunk/test/fileutils/test_fileutils.rb#L1145
       }
     end
 
+    def test_chown_dir_group_ownership_not_recursive
+      return unless @groups[1]
+
+      input_group_1 = @groups[0]
+      input_group_2 = @groups[1]
+      assert_output_lines([]) {
+        mkdir 'tmp/dir'
+        touch 'tmp/dir/a'
+        chown nil, input_group_1, ['tmp/dir', 'tmp/dir/a']
+        assert_ownership_group @groups[0], 'tmp/dir'
+        assert_ownership_group @groups[0], 'tmp/dir/a'
+        chown nil, input_group_2, 'tmp/dir'
+        assert_ownership_group @groups[1], 'tmp/dir'
+        # Make sure FileUtils.chmod does not chmod recursively
+        assert_ownership_group @groups[0], 'tmp/dir/a'
+      }
+    end
+
     if root_in_posix?
       def test_chown_with_root
         uid_1, uid_2 = distinct_uids(2)
@@ -1164,6 +1182,23 @@ class TestFileUtils < Test::Unit::TestCa https://github.com/ruby/ruby/blob/trunk/test/fileutils/test_fileutils.rb#L1182
           }
         }
       end
+
+      def test_chown_dir_user_ownership_not_recursive_with_root
+        uid_1, uid_2 = distinct_uids(2)
+        return unless uid_1 and uid_2
+
+        assert_output_lines([]) {
+          mkdir 'tmp/dir'
+          touch 'tmp/dir/a'
+          chown uid_1, nil, ['tmp/dir', 'tmp/dir/a']
+          assert_ownership_user uid_1, 'tmp/dir'
+          assert_ownership_user uid_1, 'tmp/dir/a'
+          chown uid_2, nil, 'tmp/dir'
+          assert_ownership_user uid_2, 'tmp/dir'
+          # Make sure FileUtils.chmod does not chmod recursively
+          assert_ownership_user uid_1, 'tmp/dir/a'
+        }
+      end
     else
       def test_chown_without_permission
         uid_1, uid_2 = distinct_uids(2)

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

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