diff options
| author | Baptiste Fontaine | 2016-01-04 23:14:58 +0100 |
|---|---|---|
| committer | Baptiste Fontaine | 2016-01-05 14:33:06 +0100 |
| commit | 9f1442db14f8791c6563a701a094b4fc0c2c9b56 (patch) | |
| tree | 0e6d759ea193b7b64e81eb8474711a462e305a20 /Library/Homebrew/test | |
| parent | 5d8a6e368f2c8fd5d2075cfb9dd8bb3928c2ac42 (diff) | |
| download | brew-9f1442db14f8791c6563a701a094b4fc0c2c9b56.tar.bz2 | |
doctor: move code away from cmd/
Closes Homebrew/homebrew#47665.
Signed-off-by: Baptiste Fontaine <batifon@yahoo.fr>
Diffstat (limited to 'Library/Homebrew/test')
| -rw-r--r-- | Library/Homebrew/test/test_integration_cmds.rb | 57 |
1 files changed, 56 insertions, 1 deletions
diff --git a/Library/Homebrew/test/test_integration_cmds.rb b/Library/Homebrew/test/test_integration_cmds.rb index 41cc9ac05..64ce9f76a 100644 --- a/Library/Homebrew/test/test_integration_cmds.rb +++ b/Library/Homebrew/test/test_integration_cmds.rb @@ -1,6 +1,7 @@ require "bundler" require "testing_env" require "core_formula_repository" +require "fileutils" class IntegrationCommandTests < Homebrew::TestCase def cmd_output(*args) @@ -152,7 +153,7 @@ class IntegrationCommandTests < Homebrew::TestCase cmd("readall", "--aliases", "--syntax") cmd("readall", "Homebrew/homebrew") ensure - formula_file.unlink + formula_file.unlink unless formula_file.nil? repo.alias_dir.rmtree end @@ -181,4 +182,58 @@ class IntegrationCommandTests < Homebrew::TestCase ensure Tap::TAP_DIRECTORY.rmtree end + + def test_missing + url = "file://#{File.expand_path("..", __FILE__)}/tarballs/testball-0.1.tbz" + sha256 = "1dfb13ce0f6143fe675b525fc9e168adb2215c5d5965c9f57306bb993170914f" + repo = CoreFormulaRepository.new + foo_file = repo.formula_dir/"foo.rb" + foo_file.write <<-EOS.undent + class Foo < Formula + url "#{url}" + sha256 "#{sha256}" + end + EOS + + bar_file = repo.formula_dir/"bar.rb" + bar_file.write <<-EOS.undent + class Bar < Formula + url "#{url}" + sha256 "#{sha256}" + depends_on "foo" + end + EOS + + cmd("install", "bar") + cmd("uninstall", "foo") + assert_match "foo", cmd("missing") + ensure + cmd("uninstall", "--force", "foo", "bar") + cmd("cleanup", "--force", "--prune=all") + foo_file.unlink unless foo_file.nil? + bar_file.unlink unless bar_file.nil? + end + + def test_doctor_check_path_for_trailing_slashes + assert_match "Some directories in your path end in a slash", + cmd_fail("doctor", "check_path_for_trailing_slashes", + {"PATH" => ENV["PATH"] + File::PATH_SEPARATOR + "/foo/bar/"}) + end + + def test_doctor_check_for_anaconda + mktmpdir do |path| + anaconda = "#{path}/anaconda" + python = "#{path}/python" + FileUtils.touch anaconda + File.open(python, "w") do |file| + file.write("#! #{`which bash`}\necho -n '#{python}'\n") + end + FileUtils.chmod 0777, anaconda + FileUtils.chmod 0777, python + + assert_match "Anaconda", + cmd_fail("doctor", "check_for_anaconda", + {"PATH" => path + File::PATH_SEPARATOR + ENV["PATH"]}) + end + end end |
