elharo commented on code in PR #1014:
URL: https://github.com/apache/maven/pull/1014#discussion_r1118082057


##########
maven-artifact/src/test/java/org/apache/maven/artifact/versioning/ComparableVersionTest.java:
##########
@@ -209,6 +208,26 @@ public void testVersionComparing() {
         checkVersionsOrder("2.0.1-xyz", "2.0.1-123");
     }
 
+    @Test
+    public void testLeadingZeroes() {
+        checkVersionsOrder("0.7", "2");
+        checkVersionsOrder("0.2", "1.0.7");
+    }
+
+    @Test
+    public void testGetCanonical() {
+        // MNG-7700
+        newComparable("0.x");
+        newComparable("0-x");
+        newComparable("0.rc");
+        newComparable("0-1");
+
+        ComparableVersion version = new ComparableVersion("0.x");
+        assertEquals("x", version.getCanonical());

Review Comment:
   I'm testing that the input produces the output. That is useful. There's a 
case to be made that the current behavior is wrong, which can be discussed on 
the bug. If we decide it is and change it, then having this test here will make 
it clear what changed when.
   
   The test you suggest is also good. However, it's (not so obviously) 
performed in line 220 by `newComparable("0.x")` which includes an assert to 
check that.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to