aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2013-12-21 23:28:03 -0600
committerJack Nagel2013-12-21 23:28:03 -0600
commitcc03ae4e0da7b94117007b4b79d856a9b6089769 (patch)
tree10580bfac1148afbd2594d1ea3c6d197076b262b /Library
parent1c4cd3d5c872f21587495f678069b558091b799e (diff)
downloadhomebrew-cc03ae4e0da7b94117007b4b79d856a9b6089769.tar.bz2
cleaner: add tests to document current pruning behavior
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/test/test_cleaner.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/Library/Homebrew/test/test_cleaner.rb b/Library/Homebrew/test/test_cleaner.rb
index 42eb66403..c3def7cd7 100644
--- a/Library/Homebrew/test/test_cleaner.rb
+++ b/Library/Homebrew/test/test_cleaner.rb
@@ -28,6 +28,36 @@ class CleanerTests < Test::Unit::TestCase
assert_equal 0100444, (@f.lib/'i386.dylib').stat.mode
end
+ def test_prunes_empty_directories
+ subdir = @f.bin/'subdir'
+ subdir.mkpath
+
+ Cleaner.new @f
+
+ assert !@f.bin.directory?
+ assert !subdir.directory?
+ end
+
+ def test_skip_clean_empty_directory
+ @f.class.skip_clean 'bin'
+ @f.bin.mkpath
+
+ Cleaner.new @f
+
+ assert @f.bin.directory?
+ end
+
+ def test_skip_clean_directory_with_empty_subdir
+ @f.class.skip_clean 'bin'
+ subdir = @f.bin/'subdir'
+ subdir.mkpath
+
+ Cleaner.new @f
+
+ assert @f.bin.directory?
+ assert subdir.directory?
+ end
+
def test_fails_to_remove_symlink_when_target_was_pruned_first
mkpath @f.prefix/'b'
ln_s 'b', @f.prefix/'a'