From 7b2d84337ea329cd6a230a3aabb983c59ca8b7c1 Mon Sep 17 00:00:00 2001 From: Sam Ford <1584702+samford@users.noreply.github.com> Date: Wed, 9 Apr 2025 12:44:31 -0400 Subject: [PATCH] cmd/upgrade: fix output regex in test The "upgrades with asking for user prompts with dependants checks" test for `cmd/upgrade` has been failing on CI. The regex in the test doesn't match expected output because the negative lookaheads aren't working as expected. The intention is to make sure that the names aren't repeated (i.e., second shouldn't match first, third shouldn't match first or second) but the negative lookaheads should be _inside_ the second/third capture group for this to work as intended. This updated regex should work as expected. I manually tested it using the output from CI to make sure that it matches when no formula names are repeated (e.g., `Formulae (3): testball, testball4, testball5`) and does not match if formula names are repeated (e.g., `Formulae (3): testball5, testball4, testball5`). --- Library/Homebrew/test/cmd/upgrade_spec.rb | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/Library/Homebrew/test/cmd/upgrade_spec.rb b/Library/Homebrew/test/cmd/upgrade_spec.rb index 27b9fc7891..59918aaf02 100644 --- a/Library/Homebrew/test/cmd/upgrade_spec.rb +++ b/Library/Homebrew/test/cmd/upgrade_spec.rb @@ -54,19 +54,11 @@ RSpec.describe Homebrew::Cmd::UpgradeCmd do regex = / Formulae\s*\(3\):\s* - ( - testball|testball5|testball4 - ) + (testball|testball5|testball4) \s*,\s* - (?!\1) - ( - testball|testball5|testball4 - ) + ((?!\1)testball|testball5|testball4) \s*,\s* - (?!\1|\2) - ( - testball|testball5|testball4 - ) + ((?!\1|\2)testball|testball5|testball4) /x expect do brew "upgrade", "--ask"