more diagnostic tests

This commit is contained in:
Baptiste Fontaine 2016-01-08 17:54:22 +01:00
parent 91d4ba7158
commit beb80c605f

View File

@ -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