Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#3341 - fix parsing loose version format #3379

Merged
merged 3 commits into from
Feb 18, 2023
Merged

Conversation

arturcic
Copy link
Member

@arturcic arturcic commented Feb 17, 2023

Fixes #3341

@arturcic arturcic requested a review from HHobeck February 17, 2023 08:05
@HHobeck
Copy link
Contributor

HHobeck commented Feb 18, 2023

Your fix looks quite good! I didn't find any suggestions for improvements. Maybe it might be an idea to create an additional integration test for that scenario the release branch is not in strict format:

[TestCase("release/1.2.0", "1.2.0-beta.1+1", SemanticVersionFormat.Loose)]
[TestCase("release/1.2.0", "1.2.0-beta.1+1", SemanticVersionFormat.Strict)]
[TestCase("release/1.2", "1.2.0-beta.1+1", SemanticVersionFormat.Loose)]
[TestCase("release/1", "1.0.0-beta.1+1", SemanticVersionFormat.Loose)]
public void ShouldDetectVersionInReleaseBranch(
    string branchName, string expectedVersion, SemanticVersionFormat semanticVersionFormat)
{
    var configuration = GitFlowConfigurationBuilder.New
        .WithSemanticVersionFormat(semanticVersionFormat)
        .Build();

    using var fixture = new EmptyRepositoryFixture(branchName);
    fixture.MakeACommit();
    fixture.AssertFullSemver(expectedVersion, configuration);
}

@arturcic
Copy link
Member Author

arturcic commented Feb 18, 2023

Your fix looks quite good! I didn't find any suggestions for improvements. Maybe it might be an idea to create an additional integration test for that scenario the release branch is not in strict format:

[TestCase("release/1.2.0", "1.2.0-beta.1+1", SemanticVersionFormat.Loose)]
[TestCase("release/1.2.0", "1.2.0-beta.1+1", SemanticVersionFormat.Strict)]
[TestCase("release/1.2", "1.2.0-beta.1+1", SemanticVersionFormat.Loose)]
[TestCase("release/1", "1.0.0-beta.1+1", SemanticVersionFormat.Loose)]
public void ShouldDetectVersionInReleaseBranch(
    string branchName, string expectedVersion, SemanticVersionFormat semanticVersionFormat)
{
    var configuration = GitFlowConfigurationBuilder.New
        .WithSemanticVersionFormat(semanticVersionFormat)
        .Build();

    using var fixture = new EmptyRepositoryFixture(branchName);
    fixture.MakeACommit();
    fixture.AssertFullSemver(expectedVersion, configuration);
}

sure I will include this one as well, thanks

@arturcic arturcic added this pull request to the merge queue Feb 18, 2023
@arturcic arturcic removed this pull request from the merge queue due to a manual request Feb 18, 2023
@arturcic arturcic merged commit 926c38d into GitTools:main Feb 18, 2023
@arturcic arturcic deleted the fix/3341 branch February 18, 2023 10:41
@mergify
Copy link
Contributor

mergify bot commented Feb 18, 2023

Thank you @arturcic for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Failed to parse 0.1 into a Semantic Version (v 6.0.0-alpha.1)
3 participants