|
1 | 1 | using GitTools.Testing;
|
2 | 2 | using GitVersion.Core.Tests.Helpers;
|
| 3 | +using GitVersion.Model.Configuration; |
3 | 4 | using LibGit2Sharp;
|
4 | 5 | using NUnit.Framework;
|
5 | 6 | using Shouldly;
|
| 7 | +using System.Collections.Generic; |
6 | 8 |
|
7 | 9 | namespace GitVersion.Core.Tests.IntegrationTests
|
8 | 10 | {
|
@@ -53,5 +55,37 @@ public void ShouldNotGetVersionFromFeatureBranchIfNotMerged()
|
53 | 55 | var version = fixture.GetVersion();
|
54 | 56 | version.SemVer.ShouldBe("1.0.0-alpha.1");
|
55 | 57 | }
|
| 58 | + |
| 59 | + [TestCase("alpha", "JIRA-123", "alpha")] |
| 60 | + [TestCase("useBranchName", "JIRA-123", "JIRA-123")] |
| 61 | + [TestCase("alpha.{BranchName}", "JIRA-123", "alpha.JIRA-123")] |
| 62 | + public void TagIsBranchNameForBranchesWithoutPrefixedBranchName(string tag, string branchName, string preReleaseTagName) |
| 63 | + { |
| 64 | + var config = new Config |
| 65 | + { |
| 66 | + Branches = |
| 67 | + { |
| 68 | + { |
| 69 | + "other", |
| 70 | + new BranchConfig |
| 71 | + { |
| 72 | + Increment = IncrementStrategy.Patch, |
| 73 | + Regex = ".*", |
| 74 | + SourceBranches = new HashSet<string>(), |
| 75 | + Tag = tag |
| 76 | + } |
| 77 | + } |
| 78 | + } |
| 79 | + }; |
| 80 | + |
| 81 | + using var fixture = new EmptyRepositoryFixture(); |
| 82 | + fixture.Repository.MakeATaggedCommit("1.0.0"); |
| 83 | + fixture.Repository.CreateBranch(branchName); |
| 84 | + Commands.Checkout(fixture.Repository, branchName); |
| 85 | + fixture.Repository.MakeCommits(5); |
| 86 | + |
| 87 | + var expectedFullSemVer = $"1.0.1-{preReleaseTagName}.1+5"; |
| 88 | + fixture.AssertFullSemver(expectedFullSemVer, config); |
| 89 | + } |
56 | 90 | }
|
57 | 91 | }
|
0 commit comments