Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Library/Homebrew/api/formula_struct.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ def self.from_hash(formula_hash)
T.any(
# Formula name: "foo"
String,
# Formula name and dependency type: { "foo" => :build }
T::Hash[String, Symbol],
# Formula name and dependency types: { "foo" => :build } or { "foo" => [:test, :no_linkage] }
T::Hash[String, T.any(Symbol, T::Array[Symbol])],
),
# Requirements
T.any(
Expand Down
15 changes: 15 additions & 0 deletions Library/Homebrew/test/api/formula_struct_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,21 @@ def build_formula_struct(checksums)
expect(restored).to eq(original)
end

it "preserves tagged dependencies after serialize then deserialize" do
original = described_class.new(
desc: "tagged dependencies",
homepage: "https://example.com",
license: "MIT",
ruby_source_checksum: "abc123",
stable_version: "1.0.0",
stable_dependencies: ["dep1", { "dep2" => :no_linkage }, { "dep3" => [:test, :no_linkage] }],
)

restored = described_class.deserialize(original.serialize)

expect(restored.stable_dependencies).to eq(original.stable_dependencies)
end

it "serializes post-install steps", :needs_macos do
original = described_class.new(
desc: "install steps test",
Expand Down
Loading