-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18012 from apainintheneck/verify-more-constants-n…
…ot-loaded-at-startup Verify more constants are not loaded at startup
- Loading branch information
Showing
3 changed files
with
42 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 0 additions & 23 deletions
23
Library/Homebrew/test/support/helper/cmd/brew-verify-formula-undefined.rb
This file was deleted.
Oops, something went wrong.
40 changes: 40 additions & 0 deletions
40
Library/Homebrew/test/support/helper/cmd/brew-verify-undefined.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# typed: strict | ||
# frozen_string_literal: true | ||
|
||
require "cli/parser" | ||
|
||
UNDEFINED_CONSTANTS = %w[ | ||
Cask::Cask | ||
Formula | ||
Formulary | ||
Homebrew::API | ||
Tap | ||
].freeze | ||
|
||
module Homebrew | ||
module Cmd | ||
class VerifyUndefined < AbstractCommand | ||
end | ||
end | ||
end | ||
|
||
parser = Homebrew::CLI::Parser.new(Homebrew::Cmd::VerifyUndefined) do | ||
usage_banner <<~EOS | ||
`verify-undefined` | ||
Verifies that the following constants have not been defined | ||
at startup to make sure that startup times stay consistent. | ||
Contants: | ||
#{UNDEFINED_CONSTANTS.join("\n")} | ||
EOS | ||
end | ||
|
||
parser.parse | ||
|
||
UNDEFINED_CONSTANTS.each do |constant_name| | ||
Object.const_get(constant_name) | ||
ofail "#{constant_name} should not be defined at startup" | ||
rescue NameError | ||
# We expect this to error as it should not be defined. | ||
end |