Skip to content

Commit 8cc191d

Browse files
Casper Schmidt Wandahl-Liperarturcic
authored andcommitted
Add test case for labelling using named group
1 parent ace31c1 commit 8cc191d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/GitVersion.Core.Tests/Configuration/ConfigurationExtensionsTests.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,20 @@ public void EnsureIsReleaseBranchWithReferenceNameWorksAsExpected(string branchN
5757
actual.IsTag.ShouldBe(expectedIsTag);
5858
isReleaseBranch.ShouldBe(expectedIsReleaseBranch);
5959
}
60+
61+
[TestCase("feature/sc-1000/Description", "^features?[/-](?<BranchName>.+)", "{BranchName}", "sc-1000-Description")]
62+
[TestCase("feature/sc-1000/Description", "^features?[/-](?<StoryNo>sc-\\d+)[-/].+", "{StoryNo}", "sc-1000")]
63+
public void EnsureGetBranchSpecificLabelWorksAsExpected(string branchName, string regularExpression, string label, string expectedLabel)
64+
{
65+
var configuration = GitFlowConfigurationBuilder.New
66+
.WithoutBranches()
67+
.WithBranch(branchName, builder => builder
68+
.WithLabel(label)
69+
.WithRegularExpression(regularExpression))
70+
.Build();
71+
72+
var effectiveConfiguration = configuration.GetEffectiveConfiguration(ReferenceName.FromBranchName(branchName));
73+
var actual = effectiveConfiguration.GetBranchSpecificLabel(ReferenceName.FromBranchName(branchName), null);
74+
actual.ShouldBe(expectedLabel);
75+
}
6076
}

0 commit comments

Comments
 (0)