Deep typecheck arrays in specs
This commit is contained in:
parent
5f1241b953
commit
e1aae25fd2
@ -12,7 +12,7 @@ class PATH
|
||||
delegate each: :@paths
|
||||
|
||||
Elem = type_member(:out) { { fixed: String } }
|
||||
Element = T.type_alias { T.nilable(T.any(Pathname, String, PATH)) }
|
||||
Element = T.type_alias { T.any(NilClass, Pathname, String, PATH) }
|
||||
private_constant :Element
|
||||
Elements = T.type_alias { T.any(Element, T::Array[Element]) }
|
||||
sig { params(paths: Elements).void }
|
||||
|
||||
@ -9,7 +9,7 @@ module Homebrew
|
||||
# 1: long option name (e.g. "--debug")
|
||||
# 2: option description (e.g. "Print debugging information")
|
||||
# 3: whether the option is hidden
|
||||
OptionsType = T.type_alias { T::Array[[String, T.nilable(String), String, T::Boolean]] }
|
||||
OptionsType = T.type_alias { T::Array[[T.nilable(String), T.nilable(String), String, T::Boolean]] }
|
||||
|
||||
sig { returns(T::Array[String]) }
|
||||
attr_reader :options_only, :flags_only, :remaining
|
||||
|
||||
@ -430,7 +430,7 @@ RSpec.describe Homebrew::DevCmd::Bottle do
|
||||
old_spec = BottleSpecification.new
|
||||
old_spec.root_url("https://failbrew.bintray.com/bottles")
|
||||
new_hash = { "root_url" => "https://testbrew.bintray.com/bottles" }
|
||||
expect(homebrew.merge_bottle_spec([:root_url], old_spec, new_hash)).to eq [
|
||||
expect(homebrew.merge_bottle_spec(["root_url"], old_spec, new_hash)).to eq [
|
||||
['root_url: old: "https://failbrew.bintray.com/bottles", new: "https://testbrew.bintray.com/bottles"'],
|
||||
[],
|
||||
]
|
||||
@ -440,7 +440,7 @@ RSpec.describe Homebrew::DevCmd::Bottle do
|
||||
old_spec = BottleSpecification.new
|
||||
old_spec.rebuild(1)
|
||||
new_hash = { "rebuild" => 2 }
|
||||
expect(homebrew.merge_bottle_spec([:rebuild], old_spec, new_hash)).to eq [
|
||||
expect(homebrew.merge_bottle_spec(["rebuild"], old_spec, new_hash)).to eq [
|
||||
['rebuild: old: "1", new: "2"'],
|
||||
[],
|
||||
]
|
||||
|
||||
@ -919,7 +919,7 @@ RSpec.describe Formula do
|
||||
f1 = formula "f1" do
|
||||
url "f1-1"
|
||||
|
||||
depends_on xcode: ["1.0", :optional]
|
||||
depends_on xcode: ["1.0", "optional"]
|
||||
end
|
||||
stub_formula_loader(f1)
|
||||
|
||||
|
||||
@ -25,6 +25,17 @@ end
|
||||
require_relative "../standalone"
|
||||
require_relative "../warnings"
|
||||
|
||||
module T
|
||||
module Types
|
||||
class TypedArray < TypedEnumerable
|
||||
# overrides Base
|
||||
def valid?(obj)
|
||||
recursively_valid?(obj)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Warnings.ignore :parser_syntax do
|
||||
require "rubocop"
|
||||
end
|
||||
|
||||
@ -86,7 +86,7 @@ module Utils
|
||||
sig {
|
||||
params(
|
||||
path: T.any(String, Pathname),
|
||||
replacement_pairs: T::Array[[T.any(Regexp, Pathname, String), T.any(Pathname, String)]],
|
||||
replacement_pairs: T::Array[[T.any(NilClass, Regexp, Pathname, String), T.any(Pathname, String)]],
|
||||
read_only_run: T::Boolean,
|
||||
silent: T::Boolean,
|
||||
).returns(String)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user