Skip to content

Commit 24ded03

Browse files
committed
Failing tests for tag usage. #186
1 parent 81af045 commit 24ded03

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

AcceptanceTests/GitHubFlow/MasterTests.cs

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,23 @@ public void GivenARepositoryWithTagAndANextVersionTxtFile_VersionShouldMatchVers
8585
}
8686
}
8787

88+
[Fact]
89+
public void GivenARepositoryWithTagAndANextVersionTxtFileAndNoCommits_VersionShouldBeTag()
90+
{
91+
using (var fixture = new EmptyRepositoryFixture())
92+
{
93+
const string ExpectedNextVersion = "1.1.0";
94+
const string TaggedVersion = "1.0.3";
95+
fixture.Repository.MakeATaggedCommit(TaggedVersion);
96+
fixture.Repository.AddNextVersionTxtFile(ExpectedNextVersion);
97+
98+
var result = fixture.ExecuteGitVersion();
99+
100+
result.ExitCode.ShouldBe(0);
101+
result.OutputVariables[VariableProvider.FullSemVer].ShouldBe("1.0.3+0");
102+
}
103+
}
104+
88105
[Fact]
89106
public void GivenARepositoryWithTagAndNoNextVersionTxtFile_VersionShouldBeTagWithBumpedPatch()
90107
{
@@ -101,6 +118,21 @@ public void GivenARepositoryWithTagAndNoNextVersionTxtFile_VersionShouldBeTagWit
101118
}
102119
}
103120

121+
[Fact]
122+
public void GivenARepositoryWithTagAndNoNextVersionTxtFileAndNoCommits_VersionShouldBeTag()
123+
{
124+
using (var fixture = new EmptyRepositoryFixture())
125+
{
126+
const string TaggedVersion = "1.0.3";
127+
fixture.Repository.MakeATaggedCommit(TaggedVersion);
128+
129+
var result = fixture.ExecuteGitVersion();
130+
131+
result.ExitCode.ShouldBe(0);
132+
result.OutputVariables[VariableProvider.FullSemVer].ShouldBe("1.0.3+0");
133+
}
134+
}
135+
104136
[Fact]
105137
public void GivenARepositoryWithTagAndOldNextVersionTxtFile_VersionShouldBeTagWithBumpedPatch()
106138
{
@@ -118,5 +150,22 @@ public void GivenARepositoryWithTagAndOldNextVersionTxtFile_VersionShouldBeTagWi
118150
result.OutputVariables[VariableProvider.FullSemVer].ShouldBe("1.1.1+5");
119151
}
120152
}
153+
154+
[Fact]
155+
public void GivenARepositoryWithTagAndOldNextVersionTxtFileAndNoCommits_VersionShouldBeTag()
156+
{
157+
using (var fixture = new EmptyRepositoryFixture())
158+
{
159+
const string NextVersionTxt = "1.0.0";
160+
const string TaggedVersion = "1.1.0";
161+
fixture.Repository.MakeATaggedCommit(TaggedVersion);
162+
fixture.Repository.AddNextVersionTxtFile(NextVersionTxt);
163+
164+
var result = fixture.ExecuteGitVersion();
165+
166+
result.ExitCode.ShouldBe(0);
167+
result.OutputVariables[VariableProvider.FullSemVer].ShouldBe("1.1.0+0");
168+
}
169+
}
121170
}
122171
}

0 commit comments

Comments
 (0)