From beb80c605fdbf1f8b958ba1268173dc415b47850 Mon Sep 17 00:00:00 2001 From: Baptiste Fontaine Date: Fri, 8 Jan 2016 17:54:22 +0100 Subject: [PATCH] more diagnostic tests --- Library/Homebrew/test/test_diagnostic.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Library/Homebrew/test/test_diagnostic.rb b/Library/Homebrew/test/test_diagnostic.rb index c4b61e9179..8aa2c6f674 100644 --- a/Library/Homebrew/test/test_diagnostic.rb +++ b/Library/Homebrew/test/test_diagnostic.rb @@ -13,6 +13,13 @@ class DiagnosticChecksTest < Homebrew::TestCase ENV.replace(@env) end + def test_inject_file_list + assert_equal "foo:\n", + @checks.inject_file_list([], "foo:\n") + assert_equal "foo:\n /a\n /b\n", + @checks.inject_file_list(%w[/a /b], "foo:\n") + end + def test_check_path_for_trailing_slashes ENV["PATH"] += File::PATH_SEPARATOR + "/foo/bar/" assert_match "Some directories in your path end in a slash", @@ -37,6 +44,19 @@ class DiagnosticChecksTest < Homebrew::TestCase end end + def test_check_for_other_package_managers + MacOS.stubs(:macports_or_fink).returns ["fink"] + assert_match "You have MacPorts or Fink installed:", + @checks.check_for_other_package_managers + end + + def test_check_for_unsupported_osx + ARGV.stubs(:homebrew_developer?).returns false + OS::Mac.stubs(:prerelease?).returns true + assert_match "We do not provide support for this pre-release version.", + @checks.check_for_unsupported_osx + end + def test_check_access_homebrew_repository mod = HOMEBREW_REPOSITORY.stat.mode & 0777 HOMEBREW_REPOSITORY.chmod 0555