Skip to content

Commit

Permalink
Merge pull request #13908 from Rylan12/test-deps-formulary
Browse files Browse the repository at this point in the history
Include test deps when loading a formula from the API
  • Loading branch information
Rylan12 committed Sep 21, 2022
2 parents 5b02645 + f66b5ff commit 0b602f6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Library/Homebrew/formulary.rb
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def self.load_formula_from_api(name, flags:)
depends_on dep
end

[:build, :recommended, :optional].each do |type|
[:build, :test, :recommended, :optional].each do |type|
json_formula["#{type}_dependencies"].each do |dep|
next if uses_from_macos_names.include? dep

Expand Down
9 changes: 5 additions & 4 deletions Library/Homebrew/test/formulary_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ def formula_json_contents(extra_items = {})
},
"build_dependencies" => ["build_dep"],
"dependencies" => ["dep"],
"test_dependencies" => ["test_dep"],
"recommended_dependencies" => ["recommended_dep"],
"optional_dependencies" => ["optional_dep"],
"uses_from_macos" => ["uses_from_macos_dep"],
Expand Down Expand Up @@ -291,9 +292,9 @@ def formula_json_contents(extra_items = {})
expect(formula).to be_a(Formula)
expect(formula.keg_only_reason.reason).to eq :provided_by_macos
if OS.mac?
expect(formula.deps.count).to eq 4
elsif OS.linux?
expect(formula.deps.count).to eq 5
elsif OS.linux?
expect(formula.deps.count).to eq 6
end
expect(formula.uses_from_macos_elements).to eq ["uses_from_macos_dep"]
expect(formula.caveats).to eq "example caveat string"
Expand Down Expand Up @@ -329,7 +330,7 @@ def formula_json_contents(extra_items = {})

formula = described_class.factory(formula_name)
expect(formula).to be_a(Formula)
expect(formula.deps.count).to eq 5
expect(formula.deps.count).to eq 6
expect(formula.deps.map(&:name).include?("variations_dep")).to be true
end

Expand All @@ -339,7 +340,7 @@ def formula_json_contents(extra_items = {})

formula = described_class.factory(formula_name)
expect(formula).to be_a(Formula)
expect(formula.deps.count).to eq 5
expect(formula.deps.count).to eq 6
expect(formula.deps.map(&:name).include?("uses_from_macos_dep")).to be true
end
end
Expand Down

0 comments on commit 0b602f6

Please sign in to comment.