Copilot commented on code in PR #437:
URL: https://github.com/apache/commons-cli/pull/437#discussion_r3740634428


##########
src/test/java/org/apache/commons/cli/help/TextHelpAppendableTest.java:
##########
@@ -280,6 +280,10 @@ void testindexOfWrapPos() {
 
         assertThrows(IllegalArgumentException.class, () -> 
TextHelpAppendable.indexOfWrap("", 0, 0));
         assertEquals(3, TextHelpAppendable.indexOfWrap("Hello", 4, 0));
+
+        // startPos + width must not overflow when width is 
TextStyle.UNSET_MAX_WIDTH (Integer.MAX_VALUE)
+        assertEquals(30, TextHelpAppendable.indexOfWrap(testString, 
Integer.MAX_VALUE, 0), "did not find break character with unbounded width");
+        assertEquals(testString.length(), 
TextHelpAppendable.indexOfWrap(testString, Integer.MAX_VALUE, 31), "overflow 
produced a negative wrap index");

Review Comment:
   Use the named constant `TextStyle.UNSET_MAX_WIDTH` instead of 
`Integer.MAX_VALUE` so the test directly reflects the API contract and won’t 
drift if the sentinel ever changes.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to