more test for dependency_expansion
Closes Homebrew/homebrew#48904. Signed-off-by: Xu Cheng <xucheng@me.com>
This commit is contained in:
		
							parent
							
								
									8749ecc383
								
							
						
					
					
						commit
						f57950404b
					
				@ -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
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user