Skip to content

Commit

Permalink
Added tests that verify single digits are valid semver strings (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcasperson authored Nov 11, 2024
1 parent 08377a1 commit 8475fba
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions source/Octopus.Versioning.Tests/VersionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,23 @@ public void TestSemVerEquivalents()
"Another `.0` after patch isn't counted");
}

[Test]
public void TestSingleDigit()
{
Assert.AreEqual(
VersionFactory.CreateSemanticVersion("0001"),
VersionFactory.CreateSemanticVersion("1.0.0.0"));
Assert.AreEqual(
VersionFactory.CreateSemanticVersion("0001"),
VersionFactory.CreateSemanticVersion("1.0"));
Assert.AreEqual(
VersionFactory.CreateSemanticVersion("0001"),
VersionFactory.CreateSemanticVersion("1"));
Assert.AreEqual(
VersionFactory.CreateSemanticVersion("1"),
VersionFactory.CreateSemanticVersion("1.0.0.0"));
}

[Test]
public void TestInvalidVersion()
{
Expand Down

0 comments on commit 8475fba

Please sign in to comment.