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
6
6
{
7
7
public struct TheVersion : IComparable < TheVersion >
8
8
{
9
- private const string versionRegex = @"(?<major>\d+)(\.?(?<minor>[^.]+))?(\.?(?<patch>[^.]+))?(\.?(?<build>.+))?" ;
9
+ private const string versionRegex = @"^ (?<major>\d+)(\.?(?<minor>[^.]+))?(\.?(?<patch>[^.]+))?(\.?(?<build>.+))?" ;
10
10
private const int PART_COUNT = 4 ;
11
11
public static TheVersion Default { get ; } = default ( TheVersion ) . Initialize ( null ) ;
12
12
Original file line number Diff line number Diff line change @@ -172,6 +172,10 @@ public void ComparisonWorks()
172
172
version1 = TheVersion . Parse ( "0.33.3" ) ;
173
173
version2 = TheVersion . Parse ( "0.33.3-beta" ) ;
174
174
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 ) ;
175
179
}
176
180
177
181
[ Test ]
@@ -208,5 +212,7 @@ public void ParsingInvalidVersionStringsWorks()
208
212
Assert . AreEqual ( TheVersion . Default , ret ) ;
209
213
ret = TheVersion . Parse ( "bla" ) ;
210
214
Assert . AreEqual ( TheVersion . Default , ret ) ;
215
+ ret = TheVersion . Parse ( "git version 2.11.1.windows.1" ) ;
216
+ Assert . AreEqual ( TheVersion . Default , ret ) ;
211
217
}
212
218
}
You can’t perform that action at this time.
0 commit comments