aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorBaptiste Fontaine2016-02-03 15:36:40 +0100
committerBaptiste Fontaine2016-02-03 16:28:28 +0100
commit299419a8813af8ce254cc4cf36bede05b6868a8c (patch)
treea885e30878525cd56a09781ba21e45a969cd5284 /Library
parent6cccc2d0fefe2474fb34e44c849ce0c0375c3a88 (diff)
downloadbrew-299419a8813af8ce254cc4cf36bede05b6868a8c.tar.bz2
tests: more integration tests
Closes Homebrew/homebrew#48785. Signed-off-by: Baptiste Fontaine <batifon@yahoo.fr>
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/test/test_integration_cmds.rb93
1 files changed, 92 insertions, 1 deletions
diff --git a/Library/Homebrew/test/test_integration_cmds.rb b/Library/Homebrew/test/test_integration_cmds.rb
index 1d3f17136..b13625307 100644
--- a/Library/Homebrew/test/test_integration_cmds.rb
+++ b/Library/Homebrew/test/test_integration_cmds.rb
@@ -53,7 +53,6 @@ class IntegrationCommandTests < Homebrew::TestCase
def cmd(*args)
output = cmd_output(*args)
- $stderr.write output unless $?.success?
assert_equal 0, $?.exitstatus
output
end
@@ -551,6 +550,98 @@ class IntegrationCommandTests < Homebrew::TestCase
cmd("cleanup", "--force", "--prune=all")
end
+ def test_deps
+ formula_dir = CoreFormulaRepository.new.formula_dir
+ formula_file1 = formula_dir/"testball1.rb"
+ formula_file2 = formula_dir/"testball2.rb"
+ formula_file3 = formula_dir/"testball3.rb"
+ formula_file1.write <<-EOS.undent
+ class Testball1 < Formula
+ url "https://example.com/testball1-0.1.tar.gz"
+ depends_on "testball2"
+ end
+ EOS
+ formula_file2.write <<-EOS.undent
+ class Testball2 < Formula
+ url "https://example.com/testball2-0.1.tar.gz"
+ depends_on "testball3"
+ end
+ EOS
+ formula_file3.write <<-EOS.undent
+ class Testball3 < Formula
+ url "https://example.com/testball3-0.1.tar.gz"
+ end
+ EOS
+
+ assert_equal "testball2\ntestball3", cmd("deps", "testball1")
+ assert_equal "testball3", cmd("deps", "testball2")
+ assert_equal "", cmd("deps", "testball3")
+
+ ensure
+ formula_file1.unlink
+ formula_file2.unlink
+ formula_file3.unlink
+ end
+
+ def test_uses
+ formula_dir = CoreFormulaRepository.new.formula_dir
+ formula_file1 = formula_dir/"testball1.rb"
+ formula_file2 = formula_dir/"testball2.rb"
+ formula_file3 = formula_dir/"testball3.rb"
+ formula_file1.write <<-EOS.undent
+ class Testball1 < Formula
+ url "https://example.com/testball1-0.1.tar.gz"
+ depends_on "testball2"
+ end
+ EOS
+ formula_file2.write <<-EOS.undent
+ class Testball2 < Formula
+ url "https://example.com/testball2-0.1.tar.gz"
+ depends_on "testball3"
+ end
+ EOS
+ formula_file3.write <<-EOS.undent
+ class Testball3 < Formula
+ url "https://example.com/testball3-0.1.tar.gz"
+ end
+ EOS
+
+ assert_equal "testball1\ntestball2", cmd("uses", "--recursive", "testball3")
+ assert_equal "testball2", cmd("uses", "testball3")
+ assert_equal "", cmd("uses", "testball1")
+ ensure
+ formula_file1.unlink
+ formula_file2.unlink
+ formula_file3.unlink
+ end
+
+ def test_log
+ FileUtils.cd HOMEBREW_REPOSITORY do
+ shutup do
+ system "git", "init"
+ system "git", "commit", "--allow-empty", "-m", "This is a test commit"
+ end
+ end
+ assert_match "This is a test commit", cmd("log")
+ ensure
+ (HOMEBREW_REPOSITORY/".git").rmtree
+ end
+
+ def test_test_bot
+ formula_file = CoreFormulaRepository.new.formula_dir/"testball.rb"
+ formula_file.write <<-EOS.undent
+ class Testball < Formula
+ url "file://#{File.expand_path("..", __FILE__)}/tarballs/testball-0.1.tbz"
+ sha256 "#{TESTBALL_SHA256}"
+ end
+ EOS
+
+ assert_match "==> brew install --verbose --build-bottle testball",
+ cmd("test-bot", "--dry-run", "testball")
+ ensure
+ formula_file.unlink
+ end
+
def test_custom_command
mktmpdir do |path|
cmd = "int-test-#{rand}"