checking other tests functions
This commit is contained in:
parent
0f919e8397
commit
885b7c6f4f
@ -86,45 +86,45 @@ RSpec.describe Homebrew::Cmd::InstallCmd do
|
||||
expect(HOMEBREW_CACHE/"Sources/testball1").to be_a_directory
|
||||
end
|
||||
|
||||
it "installs with asking for user prompts without installed dependent checks", :integration_test do
|
||||
setup_test_formula "testball1"
|
||||
|
||||
expect {
|
||||
brew "install", "--ask", "testball1"
|
||||
}.to output(/.*Formula\s*\(1\):\s*testball1.*/
|
||||
).to_stdout.and not_to_output.to_stderr
|
||||
|
||||
expect(HOMEBREW_CELLAR/"testball1/0.1/bin/test").to be_a_file
|
||||
end
|
||||
|
||||
it "installs with asking for user prompts with installed dependent checks", :integration_test do
|
||||
setup_test_formula "testball1", <<~RUBY
|
||||
depends_on "testball3"
|
||||
# should work as its not building but test doesnt pass if dependant
|
||||
# depends_on "build" => :build
|
||||
depends_on "installed"
|
||||
RUBY
|
||||
setup_test_formula "installed"
|
||||
setup_test_formula "testball3", <<~RUBY
|
||||
depends_on "testball4"
|
||||
RUBY
|
||||
setup_test_formula "testball4", <<~RUBY
|
||||
RUBY
|
||||
setup_test_formula "hiop"
|
||||
setup_test_formula "build"
|
||||
|
||||
# Mock `Formula#any_version_installed?` by creating the tab in a plausible keg directory
|
||||
keg_dir = HOMEBREW_CELLAR/"installed"/"1.0"
|
||||
keg_dir.mkpath
|
||||
touch keg_dir/AbstractTab::FILENAME
|
||||
|
||||
expect {
|
||||
brew "install", "--ask", "testball1"
|
||||
}.to output(/.*Formulae\s*\(3\):\s*testball1\s*,?\s*testball3\s*,?\s*testball4.*/
|
||||
).to_stdout.and not_to_output.to_stderr
|
||||
|
||||
expect(HOMEBREW_CELLAR/"testball1/0.1/bin/test").to be_a_file
|
||||
expect(HOMEBREW_CELLAR/"testball4/0.1/bin/testball4").to be_a_file
|
||||
expect(HOMEBREW_CELLAR/"testball3/0.1/bin/testball3").to be_a_file
|
||||
end
|
||||
# it "installs with asking for user prompts without installed dependent checks", :integration_test do
|
||||
# setup_test_formula "testball1"
|
||||
#
|
||||
# expect {
|
||||
# brew "install", "--ask", "testball1"
|
||||
# }.to output(/.*Formula\s*\(1\):\s*testball1.*/
|
||||
# ).to_stdout.and not_to_output.to_stderr
|
||||
#
|
||||
# expect(HOMEBREW_CELLAR/"testball1/0.1/bin/test").to be_a_file
|
||||
# end
|
||||
#
|
||||
# it "installs with asking for user prompts with installed dependent checks", :integration_test do
|
||||
# setup_test_formula "testball1", <<~RUBY
|
||||
# depends_on "testball5"
|
||||
# # should work as its not building but test doesnt pass if dependant
|
||||
# # depends_on "build" => :build
|
||||
# depends_on "installed"
|
||||
# RUBY
|
||||
# setup_test_formula "installed"
|
||||
# setup_test_formula "testball5", <<~RUBY
|
||||
# depends_on "testball4"
|
||||
# RUBY
|
||||
# setup_test_formula "testball4", <<~RUBY
|
||||
# RUBY
|
||||
# setup_test_formula "hiop"
|
||||
# setup_test_formula "build"
|
||||
#
|
||||
# # Mock `Formula#any_version_installed?` by creating the tab in a plausible keg directory
|
||||
# keg_dir = HOMEBREW_CELLAR/"installed"/"1.0"
|
||||
# keg_dir.mkpath
|
||||
# touch keg_dir/AbstractTab::FILENAME
|
||||
#
|
||||
# expect {
|
||||
# brew "install", "--ask", "testball1"
|
||||
# }.to output(/.*Formulae\s*\(3\):\s*testball1\s*,?\s*testball5\s*,?\s*testball4.*/
|
||||
# ).to_stdout.and not_to_output.to_stderr
|
||||
#
|
||||
# expect(HOMEBREW_CELLAR/"testball1/0.1/bin/test").to be_a_file
|
||||
# expect(HOMEBREW_CELLAR/"testball4/0.1/bin/testball4").to be_a_file
|
||||
# expect(HOMEBREW_CELLAR/"testball5/0.1/bin/testball5").to be_a_file
|
||||
# end
|
||||
end
|
||||
|
||||
@ -135,43 +135,14 @@ RSpec.shared_context "integration test" do # rubocop:disable RSpec/ContextWordin
|
||||
case name
|
||||
when /^testball/
|
||||
# Use a different tarball for testball2 to avoid lock errors when writing concurrency tests
|
||||
if name == "testball3" || name == "testball4"
|
||||
tarball = if OS.linux?
|
||||
TEST_FIXTURE_DIR/"tarballs/#{name}-0.1-linux.tbz"
|
||||
else
|
||||
TEST_FIXTURE_DIR/"tarballs/#{name}-0.1.tbz"
|
||||
end
|
||||
content = <<~RUBY
|
||||
desc "Some test"
|
||||
homepage "https://brew.sh/#{name}"
|
||||
url "file://#{tarball}"
|
||||
sha256 "#{tarball.sha256}"
|
||||
prefix = (name == "testball2") ? "testball2" : "testball"
|
||||
tarball = if OS.linux?
|
||||
TEST_FIXTURE_DIR/"tarballs/#{prefix}-0.1-linux.tbz"
|
||||
else
|
||||
TEST_FIXTURE_DIR/"tarballs/#{prefix}-0.1.tbz"
|
||||
end
|
||||
|
||||
option "with-foo", "Build with foo"
|
||||
#{bottle_block}
|
||||
def install
|
||||
STDERR.puts prefix
|
||||
(prefix/"foo"/"#{name}").write("#{name}") if build.with? "foo"
|
||||
prefix.install Dir["*"]
|
||||
(buildpath/"#{name}.c").write \
|
||||
"#include <stdio.h>\\nint main(){printf(\\"#{name}\\");return 0;}"
|
||||
bin.mkpath
|
||||
system ENV.cc, "#{name}.c", "-o", bin/"#{name}"
|
||||
end
|
||||
|
||||
#{content}
|
||||
|
||||
# something here
|
||||
RUBY
|
||||
else
|
||||
prefix = (name == "testball2") ? "testball2" : "testball"
|
||||
tarball = if OS.linux?
|
||||
TEST_FIXTURE_DIR/"tarballs/#{prefix}-0.1-linux.tbz"
|
||||
else
|
||||
TEST_FIXTURE_DIR/"tarballs/#{prefix}-0.1.tbz"
|
||||
end
|
||||
|
||||
content = <<~RUBY
|
||||
content = <<~RUBY
|
||||
desc "Some test"
|
||||
homepage "https://brew.sh/#{name}"
|
||||
url "file://#{tarball}"
|
||||
@ -192,7 +163,6 @@ RSpec.shared_context "integration test" do # rubocop:disable RSpec/ContextWordin
|
||||
|
||||
# something here
|
||||
RUBY
|
||||
end
|
||||
when "bar"
|
||||
content = <<~RUBY
|
||||
url "https://brew.sh/#{name}-1.0"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user