Remove trailing version from short_version.

This commit is contained in:
Markus Reiter 2020-12-14 09:26:30 +01:00
parent 7c6116af99
commit 7b9556db06
2 changed files with 3 additions and 0 deletions

View File

@ -67,6 +67,8 @@ module Homebrew
sig { returns(T::Array[String]) } sig { returns(T::Array[String]) }
def nice_parts def nice_parts
short_version = self.short_version&.delete_suffix("(#{version})") if version
return [short_version] if short_version == version return [short_version] if short_version == version
if short_version && version if short_version && version

View File

@ -17,6 +17,7 @@ describe Homebrew::BundleVersion do
["1.2.3.4000", "4000"] => "1.2.3.4000", ["1.2.3.4000", "4000"] => "1.2.3.4000",
["5", "5.0.45"] => "5.0.45", ["5", "5.0.45"] => "5.0.45",
["XQuartz-2.7.11", "2.7.112"] => "2.7.11", ["XQuartz-2.7.11", "2.7.112"] => "2.7.11",
["2.5.2(3329)", "3329"] => "2.5.2,3329",
} }
expected_mappings.each do |(short_version, version), expected_version| expected_mappings.each do |(short_version, version), expected_version|