diff options
| author | Xu Cheng | 2016-02-06 14:14:41 +0800 |
|---|---|---|
| committer | Xu Cheng | 2016-02-07 14:58:05 +0800 |
| commit | f57950404b94a4c95966eb38251c55e6f2ea29dc (patch) | |
| tree | e4f2d0a9fb5e1b4beb1b4202aff8de1a552a7077 /Library/Homebrew | |
| parent | 8749ecc3839c6093f56c6b80ebf794266a611472 (diff) | |
| download | brew-f57950404b94a4c95966eb38251c55e6f2ea29dc.tar.bz2 | |
more test for dependency_expansion
Closes Homebrew/homebrew#48904.
Signed-off-by: Xu Cheng <xucheng@me.com>
Diffstat (limited to 'Library/Homebrew')
| -rw-r--r-- | Library/Homebrew/test/test_dependency_expansion.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Library/Homebrew/test/test_dependency_expansion.rb b/Library/Homebrew/test/test_dependency_expansion.rb index 80947376f..2cad3cda0 100644 --- a/Library/Homebrew/test/test_dependency_expansion.rb +++ b/Library/Homebrew/test/test_dependency_expansion.rb @@ -115,4 +115,20 @@ class DependencyExpansionTests < Homebrew::TestCase assert_equal [@foo, @bar, @baz, @qux], @f.deps assert_equal [@bar, @baz], Dependency.expand(@f, [@bar, @baz]) end + + def test_cyclic_dependency + foo = build_dep(:foo) + bar = build_dep(:bar, [], [foo]) + foo.stubs(:to_formula).returns(stub(:deps => [bar], :name => "foo")) + f = stub(:name => "f", :deps => [foo, bar]) + assert_nothing_raised { Dependency.expand(f) } + end + + def test_clean_expand_stack + foo = build_dep(:foo) + foo.stubs(:to_formula).raises(FormulaUnavailableError, "foo") + f = stub(:name => "f", :deps => [foo]) + assert_raises(FormulaUnavailableError) { Dependency.expand(f) } + assert_empty Dependency.instance_variable_get(:@expand_stack) + end end |
