@@ -171,10 +171,26 @@ public void TagInfo_Constructor_HandlesComplexPrefix()
171171 }
172172
173173 /// <summary>
174- /// Test that TagInfo does not falsely detect rc in words like 'arch' .
174+ /// Test that TagInfo correctly parses build metadata with plus separator .
175175 /// </summary>
176176 [ TestMethod ]
177- public void TagInfo_Constructor_DoesNotFalselyDetectRcInArch ( )
177+ public void TagInfo_Constructor_ParsesBuildMetadata ( )
178+ {
179+ // Arrange & Act
180+ var tagVersion = TagInfo . Create ( "v1.0.0+arch" ) ;
181+ Assert . IsNotNull ( tagVersion ) ;
182+
183+ // Assert
184+ Assert . AreEqual ( "v1.0.0+arch" , tagVersion . Tag ) ;
185+ Assert . AreEqual ( "1.0.0+arch" , tagVersion . FullVersion ) ;
186+ Assert . IsFalse ( tagVersion . IsPreRelease ) ;
187+ }
188+
189+ /// <summary>
190+ /// Test that TagInfo accepts dot-separated pre-release and treats it as pre-release.
191+ /// </summary>
192+ [ TestMethod ]
193+ public void TagInfo_Constructor_AcceptsDotSeparatedAsPreRelease ( )
178194 {
179195 // Arrange & Act
180196 var tagVersion = TagInfo . Create ( "v1.0.0.arch" ) ;
@@ -183,7 +199,39 @@ public void TagInfo_Constructor_DoesNotFalselyDetectRcInArch()
183199 // Assert
184200 Assert . AreEqual ( "v1.0.0.arch" , tagVersion . Tag ) ;
185201 Assert . AreEqual ( "1.0.0.arch" , tagVersion . FullVersion ) ;
186- Assert . IsFalse ( tagVersion . IsPreRelease ) ;
202+ Assert . IsTrue ( tagVersion . IsPreRelease ) ;
203+ }
204+
205+ /// <summary>
206+ /// Test that TagInfo correctly parses complex version with prefix, pre-release, and metadata.
207+ /// </summary>
208+ [ TestMethod ]
209+ public void TagInfo_Constructor_ParsesComplexVersionWithMetadata ( )
210+ {
211+ // Arrange & Act
212+ var tagVersion = TagInfo . Create ( "Rel_1.2.3.rc.4+build.5" ) ;
213+ Assert . IsNotNull ( tagVersion ) ;
214+
215+ // Assert
216+ Assert . AreEqual ( "Rel_1.2.3.rc.4+build.5" , tagVersion . Tag ) ;
217+ Assert . AreEqual ( "1.2.3.rc.4+build.5" , tagVersion . FullVersion ) ;
218+ Assert . IsTrue ( tagVersion . IsPreRelease ) ;
219+ }
220+
221+ /// <summary>
222+ /// Test that TagInfo correctly parses complex version with hyphen separator for pre-release.
223+ /// </summary>
224+ [ TestMethod ]
225+ public void TagInfo_Constructor_ParsesComplexVersionWithHyphenPreRelease ( )
226+ {
227+ // Arrange & Act
228+ var tagVersion = TagInfo . Create ( "Rel_1.2.3-rc.4+build.5" ) ;
229+ Assert . IsNotNull ( tagVersion ) ;
230+
231+ // Assert
232+ Assert . AreEqual ( "Rel_1.2.3-rc.4+build.5" , tagVersion . Tag ) ;
233+ Assert . AreEqual ( "1.2.3-rc.4+build.5" , tagVersion . FullVersion ) ;
234+ Assert . IsTrue ( tagVersion . IsPreRelease ) ;
187235 }
188236
189237 /// <summary>
@@ -201,4 +249,20 @@ public void TagInfo_Constructor_CorrectlyDetectsRcWithNumber()
201249 Assert . AreEqual ( "1.0.0-rc1" , tagVersion . FullVersion ) ;
202250 Assert . IsTrue ( tagVersion . IsPreRelease ) ;
203251 }
252+
253+ /// <summary>
254+ /// Test that TagInfo correctly parses pre-release with build metadata.
255+ /// </summary>
256+ [ TestMethod ]
257+ public void TagInfo_Constructor_ParsesPreReleaseWithBuildMetadata ( )
258+ {
259+ // Arrange & Act
260+ var tagVersion = TagInfo . Create ( "v2.0.0-beta.1+linux.x64" ) ;
261+ Assert . IsNotNull ( tagVersion ) ;
262+
263+ // Assert
264+ Assert . AreEqual ( "v2.0.0-beta.1+linux.x64" , tagVersion . Tag ) ;
265+ Assert . AreEqual ( "2.0.0-beta.1+linux.x64" , tagVersion . FullVersion ) ;
266+ Assert . IsTrue ( tagVersion . IsPreRelease ) ;
267+ }
204268}
0 commit comments