Handle formatted versions ending with build version.

This commit is contained in:
Markus Reiter 2020-12-07 01:07:10 +01:00
parent 96bbf1ac15
commit d6f30a4bc1
2 changed files with 11 additions and 9 deletions

View File

@ -275,7 +275,7 @@ module Homebrew
end
if short_version&.match?(/\A\d+(\.\d+)*\Z/) && version&.match?(/\A\d+\Z/)
return short_version if short_version.start_with?("#{version}.")
return short_version if short_version.start_with?("#{version}.") || short_version.end_with?(".#{version}")
return "#{short_version},#{version}"
end

View File

@ -17,6 +17,8 @@ describe "Homebrew.bump_unversioned_casks_args" do
["1.2.3", "8312"] => "1.2.3,8312",
["2021", "2006"] => "2021,2006",
["1.0", "1"] => "1.0",
["1.0", "0"] => "1.0",
["1.2.3.4000", "4000"] => "1.2.3.4000",
}
expected_mappings.each do |(short_version, version), expected_version|