Skip to content

Commit

Permalink
cleaner: add more tests for current behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
jacknagel committed Dec 22, 2013
1 parent 8cb9799 commit e210c3f
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions Library/Homebrew/test/test_cleaner.rb
Expand Up @@ -139,4 +139,63 @@ def test_skip_clean_symlink_when_target_pruned
assert symlink.symlink?
assert !symlink.exist?
end

def test_removes_la_files
file = @f.lib/'foo.la'

@f.lib.mkpath
touch file

Cleaner.new @f

assert !file.exist?
end

def test_skip_clean_la
file = @f.lib/'foo.la'

@f.class.skip_clean :la
@f.lib.mkpath
touch file

Cleaner.new @f

assert file.exist?
end

def test_remove_charset_alias
file = @f.lib/'charset.alias'

@f.lib.mkpath
touch file

Cleaner.new @f

assert !file.exist?
end

def test_skip_clean_subdir
dir = @f.lib/'subdir'
@f.class.skip_clean 'lib/subdir'

dir.mkpath

Cleaner.new @f

assert dir.directory?
end

def test_skip_clean_paths_are_anchored_to_prefix
dir1 = @f.bin/'a'
dir2 = @f.lib/'bin/a'

@f.class.skip_clean 'bin/a'
dir1.mkpath
dir2.mkpath

Cleaner.new @f

assert dir1.exist?
assert !dir2.exist?
end
end

0 comments on commit e210c3f

Please sign in to comment.