Skip to content

Commit 5f5bceb

Browse files
author
Oren Novotny
committed
Add test for padding
1 parent 2e113e4 commit 5f5bceb

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"Major":1,
3+
"Minor":2,
4+
"Patch":3,
5+
"PreReleaseTag":"unstable.4",
6+
"PreReleaseTagWithDash":"-unstable.4",
7+
"BuildMetaData":5,
8+
"BuildMetaDataPadded":"05",
9+
"FullBuildMetaData":"5.Branch.develop.Sha.commitSha",
10+
"MajorMinorPatch":"1.2.3",
11+
"SemVer":"1.2.3-unstable.4",
12+
"LegacySemVer":"1.2.3-unstable4",
13+
"LegacySemVerPadded":"1.2.3-unstable00004",
14+
"AssemblySemVer":"1.2.3.0",
15+
"FullSemVer":"1.2.3-unstable.4+5",
16+
"InformationalVersion":"1.2.3-unstable.4+5.Branch.develop.Sha.commitSha",
17+
"BranchName":"develop",
18+
"Sha":"commitSha",
19+
"NuGetVersionV2":"1.2.3-unstable00004",
20+
"NuGetVersion":"1.2.3-unstable00004",
21+
"CommitDate":"2014-03-06"
22+
}

src/GitVersionCore.Tests/VariableProviderTests.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,29 @@ public void ProvidesVariablesInContinuousDeliveryModeForPreRelease()
3030
Approvals.Verify(JsonOutputFormatter.ToJson(vars));
3131
}
3232

33+
[Test]
34+
public void ProvidesVariablesInContinuousDeliveryModeForPreReleaseWithPadding()
35+
{
36+
var semVer = new SemanticVersion
37+
{
38+
Major = 1,
39+
Minor = 2,
40+
Patch = 3,
41+
PreReleaseTag = "unstable.4",
42+
BuildMetaData = "5.Branch.develop"
43+
};
44+
45+
semVer.BuildMetaData.Sha = "commitSha";
46+
semVer.BuildMetaData.CommitDate = DateTimeOffset.Parse("2014-03-06 23:59:59Z");
47+
48+
49+
var config = new TestEffectiveConfiguration(buildMetaDataPadding: 2, legacySemVerPadding: 5);
50+
51+
var vars = VariableProvider.GetVariablesFor(semVer, config, false);
52+
53+
Approvals.Verify(JsonOutputFormatter.ToJson(vars));
54+
}
55+
3356
[Test]
3457
public void ProvidesVariablesInContinuousDeploymentModeForPreRelease()
3558
{

0 commit comments

Comments
 (0)