summaryrefslogtreecommitdiff
path: root/src/SMAPI.Tests/Utilities
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2018-01-12 01:24:49 -0500
committerJesse Plamondon-Willard <github@jplamondonw.com>2018-01-12 01:24:49 -0500
commit0ad9fbddddbf9edfd847c507d70e10d2f8ce559b (patch)
treea7bf3bd2b04767bbb0ad9c23fdb3e7ea0edee895 /src/SMAPI.Tests/Utilities
parentdc2ceb39f31c35752c943b5052d5abaa7b6494fa (diff)
downloadSMAPI-0ad9fbddddbf9edfd847c507d70e10d2f8ce559b.tar.gz
SMAPI-0ad9fbddddbf9edfd847c507d70e10d2f8ce559b.tar.bz2
SMAPI-0ad9fbddddbf9edfd847c507d70e10d2f8ce559b.zip
fix semantic versions always ignoring `-0` tag (#421)
Diffstat (limited to 'src/SMAPI.Tests/Utilities')
-rw-r--r--src/SMAPI.Tests/Utilities/SemanticVersionTests.cs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/SMAPI.Tests/Utilities/SemanticVersionTests.cs b/src/SMAPI.Tests/Utilities/SemanticVersionTests.cs
index d3e0988e..f1a72012 100644
--- a/src/SMAPI.Tests/Utilities/SemanticVersionTests.cs
+++ b/src/SMAPI.Tests/Utilities/SemanticVersionTests.cs
@@ -33,6 +33,7 @@ namespace StardewModdingAPI.Tests.Utilities
[TestCase(3000, 4000, 5000, null, ExpectedResult = "3000.4000.5000")]
[TestCase(1, 2, 3, "", ExpectedResult = "1.2.3")]
[TestCase(1, 2, 3, " ", ExpectedResult = "1.2.3")]
+ [TestCase(1, 2, 3, "0", ExpectedResult = "1.2.3-0")]
[TestCase(1, 2, 3, "some-tag.4", ExpectedResult = "1.2.3-some-tag.4")]
[TestCase(1, 2, 3, "some-tag.4 ", ExpectedResult = "1.2.3-some-tag.4")]
public string Constructor_FromParts(int major, int minor, int patch, string tag)
@@ -270,6 +271,22 @@ namespace StardewModdingAPI.Tests.Utilities
Assert.IsTrue(version.IsOlderThan(new SemanticVersion("1.2.30")), "The game version should be considered older than the later semantic versions.");
}
+ /****
+ ** LegacyManifestVersion
+ ****/
+ [Test(Description = "Assert that the LegacyManifestVersion subclass correctly parses legacy manifest versions.")]
+ [TestCase(1, 0, 0, null, ExpectedResult = "1.0")]
+ [TestCase(3000, 4000, 5000, null, ExpectedResult = "3000.4000.5000")]
+ [TestCase(1, 2, 3, "", ExpectedResult = "1.2.3")]
+ [TestCase(1, 2, 3, " ", ExpectedResult = "1.2.3")]
+ [TestCase(1, 2, 3, "0", ExpectedResult = "1.2.3")] // special case: drop '0' tag for legacy manifest versions
+ [TestCase(1, 2, 3, "some-tag.4", ExpectedResult = "1.2.3-some-tag.4")]
+ [TestCase(1, 2, 3, "some-tag.4 ", ExpectedResult = "1.2.3-some-tag.4")]
+ public string LegacyManifestVersion(int major, int minor, int patch, string tag)
+ {
+ return new LegacyManifestVersion(major, minor, patch, tag).ToString();
+ }
+
/*********
** Private methods