From c72598d93758e07482a3868c9a2be063049eda86 Mon Sep 17 00:00:00 2001 From: Issy Long Date: Thu, 11 Apr 2024 16:45:31 +0100 Subject: [PATCH] Test that `EnvConfig::ENVS` hash keys are alphabetical - Spoiler: they aren't. - As part of Volunteer Month at work I introduced `hharen` to contributing to Homebrew, `cd $(brew --repo)`, `brew tests`, `brew style`, etc. - We started to write a RuboCop for this. But my current thinking is that this test might be sufficient since it might be easier to notice "oop, a test is failing and I've added a new envvar" and re-alphabetize it than to write a RuboCop linter for it to do the one-time autofix. Considering how little this gets changed? Co-authored-by: Hana --- Library/Homebrew/test/env_config_spec.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Library/Homebrew/test/env_config_spec.rb b/Library/Homebrew/test/env_config_spec.rb index 02fdd05948..39a2613fbf 100644 --- a/Library/Homebrew/test/env_config_spec.rb +++ b/Library/Homebrew/test/env_config_spec.rb @@ -5,6 +5,12 @@ require "diagnostic" RSpec.describe Homebrew::EnvConfig do subject(:env_config) { described_class } + describe "ENVS" do + it "sorts alphabetically" do + expect(env_config::ENVS.keys).to eql(env_config::ENVS.keys.sort) + end + end + describe ".env_method_name" do it "generates method names" do expect(env_config.env_method_name("HOMEBREW_FOO", {})).to eql("foo")