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

ruby-changes:58992

From: Nobuyoshi <ko1@a...>
Date: Sat, 30 Nov 2019 22:25:03 +0900 (JST)
Subject: [ruby-changes:58992] aab74fc938 (master): [ruby/fileutils] Added `test_install_mode_option`

https://git.ruby-lang.org/ruby.git/commit/?id=aab74fc938

From aab74fc938453233a5f11a093ad6129a0be230d1 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Thu, 3 Oct 2019 01:17:26 +0900
Subject: [ruby/fileutils] Added `test_install_mode_option`

https://github.com/ruby/fileutils/commit/bb10efe104

diff --git a/test/fileutils/test_fileutils.rb b/test/fileutils/test_fileutils.rb
index 1be4434..ca435ed1 100644
--- a/test/fileutils/test_fileutils.rb
+++ b/test/fileutils/test_fileutils.rb
@@ -1160,6 +1160,30 @@ class TestFileUtils < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/fileutils/test_fileutils.rb#L1160
     }
   end
 
+  def test_install_mode_option
+    File.open('tmp/a', 'w') {|f| f.puts 'aaa' }
+    install 'tmp/a', 'tmp/b', :mode => "u=wrx,g=rx,o=x"
+    assert_filemode 0751, 'tmp/b'
+    install 'tmp/b', 'tmp/c', :mode => "g+w-x"
+    assert_filemode 0761, 'tmp/c'
+    install 'tmp/c', 'tmp/d', :mode => "o+r,g=o+w,o-r,u-o" # 761 => 763 => 773 => 771 => 671
+    assert_filemode 0671, 'tmp/d'
+    install 'tmp/d', 'tmp/e', :mode => "go=u"
+    assert_filemode 0666, 'tmp/e'
+    install 'tmp/e', 'tmp/f', :mode => "u=wrx,g=,o="
+    assert_filemode 0700, 'tmp/f'
+    install 'tmp/f', 'tmp/g', :mode => "u=rx,go="
+    assert_filemode 0500, 'tmp/g'
+    install 'tmp/g', 'tmp/h', :mode => "+wrx"
+    assert_filemode 0777, 'tmp/h'
+    install 'tmp/h', 'tmp/i', :mode => "u+s,o=s"
+    assert_filemode 04770, 'tmp/i'
+    install 'tmp/i', 'tmp/j', :mode => "u-w,go-wrx"
+    assert_filemode 04500, 'tmp/j'
+    install 'tmp/j', 'tmp/k', :mode => "+s"
+    assert_filemode 06500, 'tmp/k'
+  end if have_file_perm?
+
   def test_chmod
     check_singleton :chmod
 
-- 
cgit v0.10.2


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

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