diff options
| author | Jack Nagel | 2013-01-13 20:05:09 -0600 |
|---|---|---|
| committer | Jack Nagel | 2013-01-13 21:01:15 -0600 |
| commit | fe4f39dcee409c8b9b164f20d86024ae02a792b2 (patch) | |
| tree | 38e57a5cf2915f6b991450e07be506e0e495ea39 /Library/Homebrew/test/test_dependencies.rb | |
| parent | e629f14d56b803ffbc7f3470175f2b021a8816eb (diff) | |
| download | brew-fe4f39dcee409c8b9b164f20d86024ae02a792b2.tar.bz2 | |
Split up dependency test coverage
The DependencyCollector tests are really integration tests, while the
rest are closer to real unit tests. Split them up so that the tests can
be run in isolation on a per-class basis.
Diffstat (limited to 'Library/Homebrew/test/test_dependencies.rb')
| -rw-r--r-- | Library/Homebrew/test/test_dependencies.rb | 83 |
1 files changed, 0 insertions, 83 deletions
diff --git a/Library/Homebrew/test/test_dependencies.rb b/Library/Homebrew/test/test_dependencies.rb index 68c4043cb..acf613b3d 100644 --- a/Library/Homebrew/test/test_dependencies.rb +++ b/Library/Homebrew/test/test_dependencies.rb @@ -1,40 +1,6 @@ require 'testing_env' -require 'test/testball' require 'dependencies' -module DependencyCollectorTestExtension - def find_dependency(name) - deps.find { |dep| dep.name == name } - end -end - -class DependencyCollectorTests < Test::Unit::TestCase - def setup - @d = DependencyCollector.new.extend(DependencyCollectorTestExtension) - end - - def test_dependency_creation - @d.add 'foo' => :build - @d.add 'bar' => ['--universal', :optional] - assert_not_nil @d.find_dependency('foo') - assert_equal 2, @d.find_dependency('bar').tags.length - end - - def test_dependency_tags - assert Dependency.new('foo', :build).build? - assert Dependency.new('foo', [:build, :optional]).optional? - assert Dependency.new('foo', [:universal]).options.include? '--universal' - assert_empty Dependency.new('foo').tags - end - - def test_no_duplicate_dependencies - @d.add 'foo' - @d.add 'foo' => :build - assert_equal 1, @d.deps.count - assert_empty @d.find_dependency('foo').tags - end -end - class DependenciesTests < Test::Unit::TestCase def setup @deps = Dependencies.new @@ -71,52 +37,3 @@ class DependenciesTests < Test::Unit::TestCase assert_instance_of Array, @deps.to_ary end end - -class DependableTests < Test::Unit::TestCase - def setup - @tags = ["foo", "bar", :build] - @dep = Struct.new(:tags).new(@tags).extend(Dependable) - end - - def test_options - assert_equal %w{--foo --bar}.sort, @dep.options.sort - end - - def test_interrogation - assert @dep.build? - assert !@dep.optional? - assert !@dep.recommended? - end -end - -class DependencyTests < Test::Unit::TestCase - def test_accepts_single_tag - dep = Dependency.new("foo", "bar") - assert_equal %w{bar}, dep.tags - end - - def test_accepts_multiple_tags - dep = Dependency.new("foo", %w{bar baz}) - assert_equal %w{bar baz}.sort, dep.tags.sort - end - - def test_preserves_symbol_tags - dep = Dependency.new("foo", :build) - assert_equal [:build], dep.tags - end - - def test_accepts_symbol_and_string_tags - dep = Dependency.new("foo", [:build, "bar"]) - assert_equal [:build, "bar"], dep.tags - end - - def test_equality - foo1 = Dependency.new("foo") - foo2 = Dependency.new("foo") - bar = Dependency.new("bar") - assert_equal foo1, foo2 - assert foo1.eql?(foo2) - assert_not_equal foo1, bar - assert !foo1.eql?(bar) - end -end |
