test/formula_installer_spec: add tests for cyclic deps
This commit is contained in:
parent
73d372e951
commit
fa8b80747a
@ -96,8 +96,64 @@ describe FormulaInstaller do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
specify "check installation sanity pinned dependency" do
|
describe "#check_install_sanity" do
|
||||||
dep_name = "dependency"
|
it "raises on direct cyclic dependency" do
|
||||||
|
ENV["HOMEBREW_DEVELOPER"] = "1"
|
||||||
|
|
||||||
|
dep_name = "homebrew-test-cyclic"
|
||||||
|
dep_path = CoreTap.new.formula_dir/"#{dep_name}.rb"
|
||||||
|
dep_path.write <<~RUBY
|
||||||
|
class #{Formulary.class_s(dep_name)} < Formula
|
||||||
|
url "foo"
|
||||||
|
version "0.1"
|
||||||
|
depends_on "#{dep_name}"
|
||||||
|
end
|
||||||
|
RUBY
|
||||||
|
Formulary.cache.delete(dep_path)
|
||||||
|
f = Formulary.factory(dep_name)
|
||||||
|
|
||||||
|
fi = described_class.new(f)
|
||||||
|
|
||||||
|
expect {
|
||||||
|
fi.check_install_sanity
|
||||||
|
}.to raise_error(CannotInstallFormulaError)
|
||||||
|
end
|
||||||
|
|
||||||
|
it "raises on indirect cyclic dependency" do
|
||||||
|
ENV["HOMEBREW_DEVELOPER"] = "1"
|
||||||
|
|
||||||
|
formula1_name = "homebrew-test-formula1"
|
||||||
|
formula2_name = "homebrew-test-formula2"
|
||||||
|
formula1_path = CoreTap.new.formula_dir/"#{formula1_name}.rb"
|
||||||
|
formula1_path.write <<~RUBY
|
||||||
|
class #{Formulary.class_s(formula1_name)} < Formula
|
||||||
|
url "foo"
|
||||||
|
version "0.1"
|
||||||
|
depends_on "#{formula2_name}"
|
||||||
|
end
|
||||||
|
RUBY
|
||||||
|
Formulary.cache.delete(formula1_path)
|
||||||
|
formula1 = Formulary.factory(formula1_name)
|
||||||
|
|
||||||
|
formula2_path = CoreTap.new.formula_dir/"#{formula2_name}.rb"
|
||||||
|
formula2_path.write <<~RUBY
|
||||||
|
class #{Formulary.class_s(formula2_name)} < Formula
|
||||||
|
url "foo"
|
||||||
|
version "0.1"
|
||||||
|
depends_on "#{formula1_name}"
|
||||||
|
end
|
||||||
|
RUBY
|
||||||
|
Formulary.cache.delete(formula2_path)
|
||||||
|
|
||||||
|
fi = described_class.new(formula1)
|
||||||
|
|
||||||
|
expect {
|
||||||
|
fi.check_install_sanity
|
||||||
|
}.to raise_error(CannotInstallFormulaError)
|
||||||
|
end
|
||||||
|
|
||||||
|
it "raises on pinned dependency" do
|
||||||
|
dep_name = "homebrew-test-dependency"
|
||||||
dep_path = CoreTap.new.formula_dir/"#{dep_name}.rb"
|
dep_path = CoreTap.new.formula_dir/"#{dep_name}.rb"
|
||||||
dep_path.write <<~RUBY
|
dep_path.write <<~RUBY
|
||||||
class #{Formulary.class_s(dep_name)} < Formula
|
class #{Formulary.class_s(dep_name)} < Formula
|
||||||
@ -131,6 +187,7 @@ describe FormulaInstaller do
|
|||||||
fi.check_install_sanity
|
fi.check_install_sanity
|
||||||
}.to raise_error(CannotInstallFormulaError)
|
}.to raise_error(CannotInstallFormulaError)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
specify "install fails with BuildError when a system() call fails" do
|
specify "install fails with BuildError when a system() call fails" do
|
||||||
ENV["HOMEBREW_TEST_NO_EXIT_CLEANUP"] = "1"
|
ENV["HOMEBREW_TEST_NO_EXIT_CLEANUP"] = "1"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user