From: Charles Oliver Nutter Date: Sat, 3 May 2025 00:26:53 +0000 (-0500) Subject: [ruby/strscan] jruby: Pass end index to byteListToInum X-Git-Url: https://repo.or.cz/ruby.git/commitdiff_plain/5a0306f9c1cd3c60d8b4735565a8cd794eb20ca6 [ruby/strscan] jruby: Pass end index to byteListToInum (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 --- diff --git a/test/strscan/test_stringscanner.rb b/test/strscan/test_stringscanner.rb index e895a8382b..109f8e1f9a 100644 --- a/test/strscan/test_stringscanner.rb +++ b/test/strscan/test_stringscanner.rb @@ -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