aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test/test_pathname.rb
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Homebrew/test/test_pathname.rb')
-rw-r--r--Library/Homebrew/test/test_pathname.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/Library/Homebrew/test/test_pathname.rb b/Library/Homebrew/test/test_pathname.rb
index 03e4df54c..3bfda1a17 100644
--- a/Library/Homebrew/test/test_pathname.rb
+++ b/Library/Homebrew/test/test_pathname.rb
@@ -58,6 +58,19 @@ class PathnameExtensionTests < Test::Unit::TestCase
assert_equal 'CONTENT', File.read(@file)
end
+ def test_atomic_write_preserves_permissions
+ File.open(@file, "w", 0100777) { }
+ @file.atomic_write("CONTENT")
+ assert_equal 0100777 & ~File.umask, @file.stat.mode
+ end
+
+ def test_atomic_write_preserves_default_permissions
+ @file.atomic_write("CONTENT")
+ sentinel = @file.parent.join("sentinel")
+ touch sentinel
+ assert_equal sentinel.stat.mode, @file.stat.mode
+ end
+
def test_cp
touch @file
mkdir_p @dir