diff options
| author | Jack Nagel | 2013-06-07 22:27:30 -0500 | 
|---|---|---|
| committer | Jack Nagel | 2013-06-08 12:23:15 -0500 | 
| commit | e660d7bdd84cf2db2e728e806038922de00d5ea8 (patch) | |
| tree | 900f9edb0a5151e0a3dca43ff3917e31eac5c95b /Library/Homebrew/test/test_dependency_expansion.rb | |
| parent | a41d7942a04392de7ebd8b55855e9a19fd653bc2 (diff) | |
| download | homebrew-e660d7bdd84cf2db2e728e806038922de00d5ea8.tar.bz2 | |
Merge repeated deps with differing options
When expanding dependencies, repeated deps are treated as equal and all
but the first are discarded when #uniq is called on the resulting array.
However, they may have different sets of options attached, so we cannot
assume they are the same.
After the initial expansion, we group them by name and then create a new
Dependency object for each name, merging the options from each group.
Fixes #20335.
Diffstat (limited to 'Library/Homebrew/test/test_dependency_expansion.rb')
| -rw-r--r-- | Library/Homebrew/test/test_dependency_expansion.rb | 12 | 
1 files changed, 10 insertions, 2 deletions
| diff --git a/Library/Homebrew/test/test_dependency_expansion.rb b/Library/Homebrew/test/test_dependency_expansion.rb index 84df7c88c..c3fe4ce18 100644 --- a/Library/Homebrew/test/test_dependency_expansion.rb +++ b/Library/Homebrew/test/test_dependency_expansion.rb @@ -2,8 +2,8 @@ require 'testing_env'  require 'dependency'  class DependencyExpansionTests < Test::Unit::TestCase -  def build_dep(name, deps=[]) -    dep = Dependency.new(name.to_s) +  def build_dep(name, tags=[], deps=[]) +    dep = Dependency.new(name.to_s, tags)      dep.stubs(:to_formula).returns(stub(:deps => deps))      dep    end @@ -58,4 +58,12 @@ class DependencyExpansionTests < Test::Unit::TestCase      @f = stub(:deps => @deps, :build => stub(:with? => true))      assert_equal @deps, Dependency.expand(@f)    end + +  def test_merges_repeated_deps_with_differing_options +    @foo2 = build_dep(:foo, ['option']) +    @baz2 = build_dep(:baz, ['option']) +    @deps << @foo2 << @baz2 +    deps = [@foo2, @bar, @baz2, @qux] +    assert_equal deps, Dependency.expand(@f) +  end  end | 
