public void FloatingVersionTest() { Assert.IsTrue(ComposerVersionExpression.TryParse("1.2.3", out var expr)); Assert.AreEqual("[1.2.3]", expr.Evaluate().ToString()); Assert.IsTrue(ComposerVersionExpression.TryParse("1.4.*", out expr)); Assert.AreEqual("[1.4.0,1.5.0)", expr.Evaluate().ToString()); Assert.IsTrue(ComposerVersionExpression.TryParse(">=1.0 <2.0", out expr)); Assert.AreEqual("[1.0.0,2.0.0)", expr.Evaluate().ToString()); Assert.IsTrue(ComposerVersionExpression.TryParse(">1.2", out expr)); Assert.AreEqual("(1.2.0,]", expr.Evaluate().ToString()); Assert.IsTrue(ComposerVersionExpression.TryParse(">=1.2", out expr)); Assert.AreEqual("[1.2.0,]", expr.Evaluate().ToString()); Assert.IsTrue(ComposerVersionExpression.TryParse("<1.3", out expr)); Assert.AreEqual("[,1.3.0)", expr.Evaluate().ToString()); Assert.IsTrue(ComposerVersionExpression.TryParse("1 - 2", out expr)); Assert.AreEqual("[1.0.0,3.0.0)", expr.Evaluate().ToString()); Assert.IsTrue(ComposerVersionExpression.TryParse("~1.3", out expr)); Assert.AreEqual("[1.3.0,2.0.0)", expr.Evaluate().ToString()); Assert.IsTrue(ComposerVersionExpression.TryParse("^1.2.3", out expr)); Assert.AreEqual("[1.2.3,2.0.0)", expr.Evaluate().ToString()); Assert.IsTrue(ComposerVersionExpression.TryParse("^0.3", out expr)); Assert.AreEqual("[0.3.0,0.4.0)", expr.Evaluate().ToString()); Assert.IsTrue(ComposerVersionExpression.TryParse("1.0.*", out expr)); Assert.AreEqual("[1.0.0,1.1.0)", expr.Evaluate().ToString()); }
void AssertFloatingVersion(string versionConstrain, string expectedFloatingVersion) { Assert.IsTrue(ComposerVersionExpression.TryParse(versionConstrain, out var expr)); Assert.AreEqual(expectedFloatingVersion, expr.Evaluate().ToString()); }
public void PreReleaseVersionParseTest() { Assert.IsTrue(ComposerVersionExpression.TryParse("^4.0", out var ver)); Assert.AreEqual("[4.0.0-*,5.0.0)", ver.Evaluate().ToString(true)); }