This repository was archived by the owner on Dec 5, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed
UnityExtension/Assets/Editor/UnityTests Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ namespace GitHub.Unity
66{
77 public struct TheVersion : IComparable < TheVersion >
88 {
9- private const string versionRegex = @"(?<major>\d+)(\.?(?<minor>[^.]+))?(\.?(?<patch>[^.]+))?(\.?(?<build>.+))?" ;
9+ private const string versionRegex = @"^ (?<major>\d+)(\.?(?<minor>[^.]+))?(\.?(?<patch>[^.]+))?(\.?(?<build>.+))?" ;
1010 private const int PART_COUNT = 4 ;
1111 public static TheVersion Default { get ; } = default ( TheVersion ) . Initialize ( null ) ;
1212
Original file line number Diff line number Diff line change @@ -172,6 +172,10 @@ public void ComparisonWorks()
172172 version1 = TheVersion . Parse ( "0.33.3" ) ;
173173 version2 = TheVersion . Parse ( "0.33.3-beta" ) ;
174174 Assert . IsTrue ( version1 > version2 ) ;
175+
176+ version1 = TheVersion . Parse ( "git version 2.11.1.windows.1" ) ;
177+ version2 = TheVersion . Parse ( "2.17.0.windows.1" ) ;
178+ Assert . IsTrue ( version1 < version2 ) ;
175179 }
176180
177181 [ Test ]
@@ -208,5 +212,7 @@ public void ParsingInvalidVersionStringsWorks()
208212 Assert . AreEqual ( TheVersion . Default , ret ) ;
209213 ret = TheVersion . Parse ( "bla" ) ;
210214 Assert . AreEqual ( TheVersion . Default , ret ) ;
215+ ret = TheVersion . Parse ( "git version 2.11.1.windows.1" ) ;
216+ Assert . AreEqual ( TheVersion . Default , ret ) ;
211217 }
212218}
You can’t perform that action at this time.
0 commit comments