Copilot commented on code in PR #2619:
URL: https://github.com/apache/groovy/pull/2619#discussion_r3457632986
##########
subprojects/groovy-json/src/test/groovy/groovy/json/JsonSlurperTest.groovy:
##########
@@ -741,6 +741,16 @@ class JsonSlurperTest {
assertNotNull(map.get("big"))
}
+ @Test
+ void testParseIntegerBeyondLongRange() {
+ // 9999999999999999999 exceeds Long.MAX_VALUE; it must round-trip as a
+ // BigInteger rather than silently overflowing to a wrong (negative)
long.
+ def raw = parser.parseText('9999999999999999999')
+ def value = raw instanceof Value ? raw.toValue() : raw
+ assertTrue(value instanceof BigInteger)
+ assertEquals(new BigInteger('9999999999999999999'), value)
+ }
Review Comment:
This regression test currently only exercises JsonSlurper's default parser
type (set in @BeforeEach). The PR description says the test covers all four
parser types (CHAR_BUFFER/INDEX_OVERLAY/LAX/CHARACTER_SOURCE), but this method
doesn't vary parser.type, so overlay/character-source paths aren't actually
asserted here.
--
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]