Update tests

This commit is contained in:
Douglas Eichelberger 2024-03-15 12:58:59 -07:00
parent aad08cd5a4
commit 23336aa316
2 changed files with 5 additions and 5 deletions

View File

@ -15,8 +15,8 @@ module Homebrew
abstract!
class << self
sig { returns(T.nilable(T.proc.void)) }
attr_reader :parser_block
sig { returns(T.nilable(CLI::Parser)) }
attr_reader :parser
sig { returns(String) }
def command_name = T.must(name).split("::").fetch(-1).downcase
@ -29,7 +29,7 @@ module Homebrew
sig { params(block: T.nilable(T.proc.bind(CLI::Parser).void)).void }
def cmd_args(&block)
@parser_block = T.let(block, T.nilable(T.proc.void))
@parser = T.let(CLI::Parser.new(&block), T.nilable(CLI::Parser))
end
end
@ -40,7 +40,7 @@ module Homebrew
sig { params(argv: T::Array[String]).void }
def initialize(argv = ARGV.freeze)
@args = T.let(CLI::Parser.new(&self.class.parser_block).parse(argv), CLI::Args)
@args = T.let(T.must(self.class.parser).parse(argv), CLI::Args)
end
sig { abstract.void }

View File

@ -8,7 +8,7 @@ RSpec.describe Tapioca::Compilers::Args do
let(:compiler) { described_class.new(Tapioca::Dsl::Pipeline.new(requested_constants: []), RBI::Tree.new, Homebrew) }
let(:list_parser) do
require "cmd/list"
Homebrew.list_args
Homebrew::Cmd::List.parser
end
# good testing candidate, bc it has multiple for each of switch, flag, and comma_array args:
let(:update_python_resources_parser) do