Skip to content
Snippets Groups Projects
Commit 96df4fe1 authored by Jack Nagel's avatar Jack Nagel
Browse files

Apply cyclic dependency hack unconditionally

parent e9b68707
No related branches found
No related tags found
No related merge requests found
......@@ -75,6 +75,9 @@ class Dependency
expanded_deps = []
deps.each do |dep|
# FIXME don't hide cyclic dependencies
next if dependent.name == dep.name
case action(dependent, dep, &block)
when :prune
next
......@@ -83,7 +86,6 @@ class Dependency
when :keep_but_prune_recursive_deps
expanded_deps << dep
else
next if dependent.to_s == dep.name
expanded_deps.concat(expand(dep.to_formula, &block))
expanded_deps << dep
end
......
......@@ -4,7 +4,7 @@ require 'dependency'
class DependencyExpansionTests < Test::Unit::TestCase
def build_dep(name, tags=[], deps=[])
dep = Dependency.new(name.to_s, tags)
dep.stubs(:to_formula).returns(stub(:deps => deps))
dep.stubs(:to_formula).returns(stub(:deps => deps, :name => name))
dep
end
......@@ -14,7 +14,7 @@ class DependencyExpansionTests < Test::Unit::TestCase
@baz = build_dep(:baz)
@qux = build_dep(:qux)
@deps = [@foo, @bar, @baz, @qux]
@f = stub(:deps => @deps)
@f = stub(:deps => @deps, :name => "f")
end
def test_expand_yields_dependent_and_dep_pairs
......@@ -43,19 +43,19 @@ class DependencyExpansionTests < Test::Unit::TestCase
end
def test_expand_preserves_dependency_order
@foo.stubs(:to_formula).returns(stub(:deps => [@qux, @baz]))
@foo.stubs(:to_formula).returns(stub(:name => "f", :deps => [@qux, @baz]))
assert_equal [@qux, @baz, @foo, @bar], Dependency.expand(@f)
end
def test_expand_skips_optionals_by_default
@foo.expects(:optional?).returns(true)
@f = stub(:deps => @deps, :build => stub(:with? => false))
@f = stub(:deps => @deps, :build => stub(:with? => false), :name => "f")
assert_equal [@bar, @baz, @qux], Dependency.expand(@f)
end
def test_expand_keeps_recommendeds_by_default
@foo.expects(:recommended?).returns(true)
@f = stub(:deps => @deps, :build => stub(:with? => true))
@f = stub(:deps => @deps, :build => stub(:with? => true), :name => "f")
assert_equal @deps, Dependency.expand(@f)
end
......@@ -84,7 +84,7 @@ class DependencyExpansionTests < Test::Unit::TestCase
end
def test_skip_skips_parent_but_yields_children
f = stub(:deps => [
f = stub(:name => "f", :deps => [
build_dep(:foo, [], [@bar, @baz]),
build_dep(:foo, [], [@baz]),
])
......@@ -97,7 +97,7 @@ class DependencyExpansionTests < Test::Unit::TestCase
end
def test_keep_dep_but_prune_recursive_deps
f = stub(:deps => [
f = stub(:name => "f", :deps => [
build_dep(:foo, [:build], [@bar]),
build_dep(:baz, [:build]),
])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment