Skip to content

Commit 80adc3f

Browse files
committed
GH-2587 - added tests to test the 'master' branch name replaced with 'main'
1 parent 7116ada commit 80adc3f

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

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

+38
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,44 @@ public void CanProvideConfigForNewBranch()
164164
config.Branches["bug"].Tag.ShouldBe("bugfix");
165165
}
166166

167+
[Test]
168+
public void MasterConfigReplacedWithMain()
169+
{
170+
const string text = @"
171+
next-version: 2.0.0
172+
branches:
173+
master:
174+
regex: '^master$|^main$'
175+
tag: beta";
176+
SetupConfigFileContent(text);
177+
178+
var config = configProvider.Provide(repoPath);
179+
180+
config.Branches[MainBranch].Regex.ShouldBe("^master$|^main$");
181+
config.Branches[MainBranch].Tag.ShouldBe("beta");
182+
}
183+
184+
[Test]
185+
public void MasterConfigReplacedWithMainInSourceBranches()
186+
{
187+
const string text = @"
188+
next-version: 2.0.0
189+
branches:
190+
breaking:
191+
regex: breaking[/]
192+
mode: ContinuousDeployment
193+
increment: Major
194+
source-branches: ['master']
195+
is-release-branch: false";
196+
SetupConfigFileContent(text);
197+
198+
var config = configProvider.Provide(repoPath);
199+
200+
config.Branches["breaking"].Regex.ShouldBe("breaking[/]");
201+
config.Branches["breaking"].SourceBranches.ShouldHaveSingleItem();
202+
config.Branches["breaking"].SourceBranches.ShouldContain(MainBranch);
203+
}
204+
167205
[Test]
168206
public void NextVersionCanBeInteger()
169207
{

0 commit comments

Comments
 (0)