diff --git a/src/SemanticVersioning/Version.cs b/src/SemanticVersioning/Version.cs index ec6bd38..d2e14b8 100644 --- a/src/SemanticVersioning/Version.cs +++ b/src/SemanticVersioning/Version.cs @@ -48,7 +48,6 @@ public class Version : IComparable, IComparable, IEquatable public bool IsPreRelease { get { return !string.IsNullOrEmpty(_preRelease); } } private static Regex strictRegex = new Regex(@"^ - \s* ([0-9]|[1-9][0-9]+) # major version \. ([0-9]|[1-9][0-9]+) # minor version @@ -56,7 +55,6 @@ public class Version : IComparable, IComparable, IEquatable ([0-9]|[1-9][0-9]+) # patch version (\-([0-9A-Za-z\-\.]+))? # pre-release version (\+([0-9A-Za-z\-\.]+))? # build metadata - \s* $", RegexOptions.IgnorePatternWhitespace); diff --git a/test/SemanticVersioning.Tests/ParseMajorMinorPatch.cs b/test/SemanticVersioning.Tests/ParseMajorMinorPatch.cs index 0a209e7..77cee4b 100644 --- a/test/SemanticVersioning.Tests/ParseMajorMinorPatch.cs +++ b/test/SemanticVersioning.Tests/ParseMajorMinorPatch.cs @@ -7,10 +7,9 @@ public class ParseMajorMinorPatch { [Theory] [InlineData("1.2.3", 1, false)] - [InlineData(" 1.2.3 ", 1, false)] - [InlineData(" 2.2.3-4 ", 2, false)] - [InlineData(" 3.2.3-pre ", 3, false)] - [InlineData("\t13.2.3", 13, false)] + [InlineData("2.2.3-4", 2, false)] + [InlineData("3.2.3-pre", 3, false)] + [InlineData("\t13.2.3", 13, true)] [InlineData(" v8.2.3 ", 8, true)] [InlineData("v5.2.3", 5, true)] [InlineData("=21.2.3", 21, true)] @@ -23,10 +22,9 @@ public void ParseMajorVersion(string versionString, int majorVersion, bool loose [Theory] [InlineData("1.2.3", 2, false)] - [InlineData(" 1.2.3 ", 2, false)] - [InlineData(" 2.2.3-4 ", 2, false)] - [InlineData(" 3.2.3-pre ", 2, false)] - [InlineData("\t13.2.3", 2, false)] + [InlineData("2.2.3-4", 2, false)] + [InlineData("3.2.3-pre", 2, false)] + [InlineData("\t13.2.3", 2, true)] [InlineData(" v8.2.3 ", 2, true)] [InlineData("v5.2.3", 2, true)] [InlineData("=21.2.3", 2, true)] @@ -39,10 +37,9 @@ public void ParseMinorVersion(string versionString, int minorVersion, bool loose [Theory] [InlineData("1.2.3", 3, false)] - [InlineData(" 1.2.3 ", 3, false)] - [InlineData(" 2.2.3-4 ", 3, false)] - [InlineData(" 3.2.3-pre ", 3, false)] - [InlineData("\t13.2.3", 3, false)] + [InlineData("2.2.3-4", 3, false)] + [InlineData("3.2.3-pre", 3, false)] + [InlineData("13.2.3", 3, false)] [InlineData(" v8.2.3 ", 3, true)] [InlineData("v5.2.3", 3, true)] [InlineData("=21.2.3", 3, true)] diff --git a/test/SemanticVersioning.Tests/VersionComparison.cs b/test/SemanticVersioning.Tests/VersionComparison.cs index 7744c11..5f1a4a9 100644 --- a/test/SemanticVersioning.Tests/VersionComparison.cs +++ b/test/SemanticVersioning.Tests/VersionComparison.cs @@ -189,7 +189,6 @@ public void Comparisons(string v0s, string v1s) [InlineData("1.2.3", "=1.2.3", true)] [InlineData("1.2.3", " 1.2.3", true)] [InlineData("1.2.3", "= 1.2.3", true)] - [InlineData("1.2.3", " 1.2.3", false)] [InlineData("1.2.3", " =1.2.3", true)] [InlineData("1.2.3", " v 1.2.3", true)] [InlineData("1.2.3", " = 1.2.3", true)] @@ -197,7 +196,6 @@ public void Comparisons(string v0s, string v1s) [InlineData("1.2.3-0", "=1.2.3-0", true)] [InlineData("1.2.3-0", " 1.2.3-0", true)] [InlineData("1.2.3-0", "= 1.2.3-0", true)] - [InlineData("1.2.3-0", " 1.2.3-0", false)] [InlineData("1.2.3-0", " =1.2.3-0", true)] [InlineData("1.2.3-0", " v 1.2.3-0", true)] [InlineData("1.2.3-0", " = 1.2.3-0", true)] @@ -205,7 +203,6 @@ public void Comparisons(string v0s, string v1s) [InlineData("1.2.3-1", "=1.2.3-1", true)] [InlineData("1.2.3-1", " 1.2.3-1", true)] [InlineData("1.2.3-1", "= 1.2.3-1", true)] - [InlineData("1.2.3-1", " 1.2.3-1", false)] [InlineData("1.2.3-1", " =1.2.3-1", true)] [InlineData("1.2.3-1", " v 1.2.3-1", true)] [InlineData("1.2.3-1", " = 1.2.3-1", true)] @@ -213,7 +210,6 @@ public void Comparisons(string v0s, string v1s) [InlineData("1.2.3-beta", "=1.2.3-beta", true)] [InlineData("1.2.3-beta", " 1.2.3-beta", true)] [InlineData("1.2.3-beta", "= 1.2.3-beta", true)] - [InlineData("1.2.3-beta", " 1.2.3-beta", false)] [InlineData("1.2.3-beta", " =1.2.3-beta", true)] [InlineData("1.2.3-beta", " v 1.2.3-beta", true)] [InlineData("1.2.3-beta", " = 1.2.3-beta", true)] @@ -221,7 +217,6 @@ public void Comparisons(string v0s, string v1s) [InlineData("1.2.3+build", " = 1.2.3+otherbuild", true)] [InlineData("1.2.3-beta+build", "1.2.3-beta+otherbuild", false)] [InlineData("1.2.3+build", "1.2.3+otherbuild", false)] - [InlineData(" 1.2.3+build", "1.2.3+otherbuild", false)] public void Equality(string v0s, string v1s, bool loose) { var v0 = new Version(v0s, false);