fix: compare installed package versions semantically
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
#nullable enable
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace ShrinkSDK.Installer.Tests
|
||||
{
|
||||
public sealed class ShrinkPackageVersionTests
|
||||
{
|
||||
[TestCase("1.10.0", "1.9.0", ShrinkPackageVersionRelation.Newer)]
|
||||
[TestCase("2.1.0", "2.1.0", ShrinkPackageVersionRelation.Equal)]
|
||||
[TestCase("2.0.9", "2.1.0", ShrinkPackageVersionRelation.Older)]
|
||||
[TestCase("1.0.0", "1.0.0-preview.9", ShrinkPackageVersionRelation.Newer)]
|
||||
[TestCase("1.0.0-preview.10", "1.0.0-preview.2", ShrinkPackageVersionRelation.Newer)]
|
||||
[TestCase("1.0.0+build.2", "1.0.0+build.1", ShrinkPackageVersionRelation.Equal)]
|
||||
[TestCase("git+https://example.invalid/package", "1.0.0", ShrinkPackageVersionRelation.Unknown)]
|
||||
public void Classify_UsesSemanticVersionOrdering(string installed, string target,
|
||||
ShrinkPackageVersionRelation expected)
|
||||
{
|
||||
Assert.AreEqual(expected, ShrinkPackageVersion.Classify(installed, target));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user