[Runner]Handle release tag with uppercase V during update (#33822)

## Summary of the Pull Request

The latest fix pushed with tag `V0.82.1` (uppercase V) isn't detected by
the PT internal updater.
Handle release tag with uppercase V during update.
This commit is contained in:
Davide Giacometti
2024-07-18 12:37:01 +02:00
committed by GitHub
parent d668a659b5
commit a3e193e56e
2 changed files with 15 additions and 3 deletions

View File

@@ -58,6 +58,15 @@ namespace UnitTestsVersionHelper
Assert::AreEqual(25ull, sut->minor);
Assert::AreEqual(1ull, sut->revision);
}
TEST_METHOD (stringConstructorShouldProperlyInitializationVersionNumbersWithUppercaseV)
{
auto sut = VersionHelper::fromString(L"V2.25.1");
Assert::IsTrue(sut.has_value());
Assert::AreEqual(2ull, sut->major);
Assert::AreEqual(25ull, sut->minor);
Assert::AreEqual(1ull, sut->revision);
}
TEST_METHOD (emptyStringNotAccepted)
{
auto sut = VersionHelper::fromString("");

View File

@@ -18,7 +18,8 @@ struct Constants;
template<>
struct Constants<char>
{
static inline const char* V = "v";
static inline const char* LOWER_V = "v";
static inline const char* UPPER_V = "V";
static inline const char* DOT = ".";
static inline const char SPACE = ' ';
};
@@ -26,7 +27,8 @@ struct Constants<char>
template<>
struct Constants<wchar_t>
{
static inline const wchar_t* V = L"v";
static inline const wchar_t* LOWER_V = L"v";
static inline const wchar_t* UPPER_V = L"V";
static inline const wchar_t* DOT = L".";
static inline const wchar_t SPACE = L' ';
};
@@ -36,7 +38,8 @@ std::optional<VersionHelper> fromString(std::basic_string_view<CharT> str)
{
try
{
str = left_trim<CharT>(trim<CharT>(str), Constants<CharT>::V);
str = left_trim<CharT>(trim<CharT>(str), Constants<CharT>::LOWER_V);
str = left_trim<CharT>(trim<CharT>(str), Constants<CharT>::UPPER_V);
std::basic_string<CharT> spacedStr{ str };
replace_chars<CharT>(spacedStr, Constants<CharT>::DOT, Constants<CharT>::SPACE);