os/mac/diagnostic: prevent some double diagostic failures

This commit is contained in:
Bo Anderson 2021-03-30 04:23:25 +01:00
parent 49f789d492
commit 9686ebe355
No known key found for this signature in database
GPG Key ID: 3DB94E204E137D65
2 changed files with 6 additions and 0 deletions

View File

@ -433,9 +433,13 @@ module Homebrew
locator = MacOS.sdk_locator locator = MacOS.sdk_locator
source = if locator.source == :clt source = if locator.source == :clt
return if MacOS::CLT.below_minimum_version? # Handled by other diagnostics.
update_instructions = MacOS::CLT.update_instructions update_instructions = MacOS::CLT.update_instructions
"Command Line Tools (CLT)" "Command Line Tools (CLT)"
else else
return if MacOS::Xcode.below_minimum_version? # Handled by other diagnostics.
update_instructions = MacOS::Xcode.update_instructions update_instructions = MacOS::Xcode.update_instructions
"Xcode" "Xcode"
end end

View File

@ -47,6 +47,8 @@ describe Homebrew::Diagnostic::Checks do
before do before do
allow(DevelopmentTools).to receive(:installed?).and_return(true) allow(DevelopmentTools).to receive(:installed?).and_return(true)
allow(OS::Mac).to receive(:version).and_return(macos_version) allow(OS::Mac).to receive(:version).and_return(macos_version)
allow(OS::Mac::CLT).to receive(:below_minimum_version?).and_return(false)
allow(OS::Mac::Xcode).to receive(:below_minimum_version?).and_return(false)
end end
it "doesn't trigger when SDK root is not needed" do it "doesn't trigger when SDK root is not needed" do