aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test/test_integration_cmds_prune.rb
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Homebrew/test/test_integration_cmds_prune.rb')
-rw-r--r--Library/Homebrew/test/test_integration_cmds_prune.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/Library/Homebrew/test/test_integration_cmds_prune.rb b/Library/Homebrew/test/test_integration_cmds_prune.rb
new file mode 100644
index 000000000..6072c832e
--- /dev/null
+++ b/Library/Homebrew/test/test_integration_cmds_prune.rb
@@ -0,0 +1,21 @@
+require "integration_cmds_tests"
+
+class IntegrationCommandTestPrune < IntegrationCommandTests
+ def test_prune
+ share = (HOMEBREW_PREFIX/"share")
+
+ (share/"pruneable/directory/here").mkpath
+ (share/"notpruneable/file").write "I'm here"
+ FileUtils.ln_s "/i/dont/exist/no/really/i/dont", share/"pruneable_symlink"
+
+ assert_match %r{Would remove \(empty directory\): .*/pruneable/directory/here},
+ cmd("prune", "--dry-run")
+ assert_match "Pruned 1 symbolic links and 3 directories",
+ cmd("prune")
+ refute((share/"pruneable").directory?)
+ assert((share/"notpruneable").directory?)
+ refute((share/"pruneable_symlink").symlink?)
+
+ assert_match "Nothing pruned", cmd("prune", "--verbose")
+ end
+end