[ruby/strscan] jruby: Pass end index to byteListToInum
authorCharles Oliver Nutter <[email protected]>
Sat, 3 May 2025 00:26:53 +0000 (2 19:26 -0500)
committerHiroshi SHIBATA <[email protected]>
Thu, 8 May 2025 09:03:04 +0000 (8 18:03 +0900)
(https://github.com/ruby/strscan/pull/150)

These parse methods take begin and end indices, not begin and length. A
test is included.

Fixes https://github.com/jruby/jruby/issues/8823

https://github.com/ruby/strscan/commit/9690e39e73

test/strscan/test_stringscanner.rb

index e895a83..109f8e1 100644 (file)
@@ -1006,6 +1006,12 @@ module StringScannerTests
     assert_equal(huge_integer.to_i, s.scan_integer)
     assert_equal(2_000, s.pos)
     assert_predicate(s, :matched?)
+
+    s = create_string_scanner('abc1')
+    s.pos = 3
+    assert_equal(1, s.scan_integer)
+    assert_equal(4, s.pos)
+    assert_predicate(s, :matched?)
   end
 
   def test_scan_integer_unmatch