Raise a useful exception for incomplete formulae

This commit is contained in:
Jack Nagel 2013-04-13 17:40:14 -05:00
parent 25c0ecfd63
commit a05bb48807
2 changed files with 8 additions and 1 deletions

View File

@ -73,9 +73,11 @@ class Formula
when @head && ARGV.build_head? then @head # --HEAD when @head && ARGV.build_head? then @head # --HEAD
when @devel && ARGV.build_devel? then @devel # --devel when @devel && ARGV.build_devel? then @devel # --devel
when @bottle && install_bottle?(self) then @bottle # bottle available when @bottle && install_bottle?(self) then @bottle # bottle available
when @stable then @stable
when @devel && @stable.nil? then @devel # devel-only when @devel && @stable.nil? then @devel # devel-only
when @head && @stable.nil? then @head # head-only when @head && @stable.nil? then @head # head-only
else @stable else
raise "Formulae require at least a URL"
end end
end end

View File

@ -77,4 +77,9 @@ class FormulaValidationTests < Test::Unit::TestCase
end end
end end
end end
def test_empty_formula_invalid
e = assert_raises(RuntimeError) { formula {} }
assert_equal "Formulae require at least a URL", e.message
end
end end