Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions ext/strscan/strscan.c
Original file line number Diff line number Diff line change
Expand Up @@ -1852,6 +1852,67 @@ strscan_values_at(int argc, VALUE *argv, VALUE self)
return new_ary;
}

/*
* call-seq:
* get_int(index) -> integer or nil
*
* Returns the captured substring at the given +index+ as an Integer,
* without creating an intermediate String object.
*
* Returns +nil+ if the most recent match failed, or if the capture
* at +index+ is out of range, or if the capture did not participate
* in the match.
*
* This is semantically equivalent to <tt>self[index].to_i</tt> but
* avoids the allocation of a temporary String.
*
* scanner = StringScanner.new("2024-06-15")
* scanner.scan(/(\d{4})-(\d{2})-(\d{2})/)
* scanner.get_int(1) # => 2024
* scanner.get_int(2) # => 6
* scanner.get_int(3) # => 15
* scanner.get_int(0) # => 20240615 (entire match as integer)
*
*/
static VALUE
strscan_get_int(VALUE self, VALUE idx)
{
struct strscanner *p;
long i;
long beg, end, len;
const char *ptr;
VALUE buffer_v, integer;

GET_SCANNER(self, p);
if (! MATCHED_P(p)) return Qnil;

i = NUM2LONG(idx);

if (i < 0)
i += p->regs.num_regs;
if (i < 0) return Qnil;
if (i >= p->regs.num_regs) return Qnil;
if (p->regs.beg[i] == -1) return Qnil;

beg = adjust_register_position(p, p->regs.beg[i]);
end = adjust_register_position(p, p->regs.end[i]);
len = end - beg;

if (len <= 0) return INT2FIX(0);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this integer_at parses more strict than Integer(string) that accepts "1_234".
So I think empty string case should also raise error like Integer("") raises ArgumentError.

In any case, I think it's worth adding empty string matched test case

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tompng

Thank you for your feedback. 0948c72 fixed it.


ptr = S_PBEG(p) + beg;

{
char *buffer = RB_ALLOCV_N(char, buffer_v, len + 1);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it OK that we allocate C string?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kou

Thank you for your feedback!

The original implementation did allocate a C string via RB_ALLOCV_N, which undermines the purpose of avoiding intermediate allocations. While RB_ALLOCV_N uses alloca (stack allocation) for small sizes and is much cheaper than a Ruby String, it is still an unnecessary allocation for the common case.

Updated in 4600b0a. For values up to 18 digits on 64-bit (9 on 32-bit), digits are now parsed directly from the source string's byte buffer with no allocation at all — neither Ruby String nor C string. The RB_ALLOCV_N + rb_cstr2inum path is only used as a fallback for bignum-range values (more than 18 digits).

In the primary use case of date component parsing (1-4 digit values), this means zero allocation of any kind.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use rb_int_parse_cstr.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nobu

b12e653 fixed it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, forgotten that is declared just in an internal header.
Maybe we should move them to a public header?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nobu
If we've had no issues with an internal header up until now, this change alone isn't enough to justify making it a public header.

@kou
That's my opinion, but what do you think?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we need to use rb_int_parse_cstr() in out side of Ruby (strscan), we should make it public.

MEMCPY(buffer, ptr, char, len);
buffer[len] = '\0';
integer = rb_cstr2inum(buffer, 10);
RB_ALLOCV_END(buffer_v);
}

return integer;
}

/*
* :markup: markdown
* :include: strscan/link_refs.txt
Expand Down Expand Up @@ -2290,6 +2351,7 @@ Init_strscan(void)
rb_define_method(StringScanner, "size", strscan_size, 0);
rb_define_method(StringScanner, "captures", strscan_captures, 0);
rb_define_method(StringScanner, "values_at", strscan_values_at, -1);
rb_define_method(StringScanner, "get_int", strscan_get_int, 1);

rb_define_method(StringScanner, "rest", strscan_rest, 0);
rb_define_method(StringScanner, "rest_size", strscan_rest_size, 0);
Expand Down
49 changes: 49 additions & 0 deletions test/strscan/test_stringscanner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -968,6 +968,55 @@
assert_equal({"number" => "1"}, scan.named_captures)
end

def test_get_int
s = create_string_scanner("2024-06-15")
s.scan(/(\d{4})-(\d{2})-(\d{2})/)
assert_equal(2024, s.get_int(1))

Check failure on line 974 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / macos-latest truffleruby-head

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /Users/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:974:in 'StringScannerTests#test_get_int' <internal:core> core/throw_catch.rb:36:in 'Kernel#catch' <internal:core> core/throw_catch.rb:36:in 'Kernel#catch'

Check failure on line 974 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / macos-latest truffleruby-head

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /Users/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:974:in 'StringScannerTests#test_get_int' <internal:core> core/throw_catch.rb:36:in 'Kernel#catch' <internal:core> core/throw_catch.rb:36:in 'Kernel#catch'

Check failure on line 974 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / ubuntu-latest truffleruby-head

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /home/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:974:in 'StringScannerTests#test_get_int' <internal:core> core/throw_catch.rb:36:in 'Kernel#catch' <internal:core> core/throw_catch.rb:36:in 'Kernel#catch'

Check failure on line 974 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / ubuntu-latest truffleruby-head

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /home/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:974:in 'StringScannerTests#test_get_int' <internal:core> core/throw_catch.rb:36:in 'Kernel#catch' <internal:core> core/throw_catch.rb:36:in 'Kernel#catch'

Check failure on line 974 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / macos-latest jruby-head

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /Users/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:974:in 'test_get_int' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch'

Check failure on line 974 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / macos-latest jruby-head

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /Users/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:974:in 'test_get_int' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch'

Check failure on line 974 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / macos-latest jruby

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /Users/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:974:in 'test_get_int' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch'

Check failure on line 974 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / macos-latest jruby

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /Users/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:974:in 'test_get_int' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch'

Check failure on line 974 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / ubuntu-latest jruby-9.4

Error

NoMethodError: undefined method `get_int' for #<StringScanner fin> Did you mean? get_byte /home/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:974:in `test_get_int' org/jruby/RubyKernel.java:1426:in `catch' org/jruby/RubyKernel.java:1421:in `catch' org/jruby/RubyArray.java:2018:in `each' org/jruby/RubyArray.java:2018:in `each' org/jruby/RubyKernel.java:1426:in `catch' org/jruby/RubyKernel.java:1421:in `catch'

Check failure on line 974 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / ubuntu-latest jruby-9.4

Error

NoMethodError: undefined method `get_int' for #<StringScanner fin> Did you mean? get_byte /home/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:974:in `test_get_int' org/jruby/RubyKernel.java:1426:in `catch' org/jruby/RubyKernel.java:1421:in `catch' org/jruby/RubyArray.java:2018:in `each' org/jruby/RubyArray.java:2018:in `each' org/jruby/RubyKernel.java:1426:in `catch' org/jruby/RubyKernel.java:1421:in `catch'

Check failure on line 974 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / ubuntu-latest jruby-head

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /home/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:974:in 'test_get_int' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch'

Check failure on line 974 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / ubuntu-latest jruby-head

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /home/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:974:in 'test_get_int' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch'

Check failure on line 974 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / ubuntu-latest jruby

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /home/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:974:in 'test_get_int' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch'

Check failure on line 974 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / ubuntu-latest jruby

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /home/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:974:in 'test_get_int' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch'

Check failure on line 974 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / windows-latest jruby-head

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner D:/a/strscan/strscan/test/strscan/test_stringscanner.rb:974:in 'test_get_int' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch'

Check failure on line 974 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / windows-latest jruby-head

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner D:/a/strscan/strscan/test/strscan/test_stringscanner.rb:974:in 'test_get_int' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch'

Check failure on line 974 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / windows-latest jruby

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner D:/a/strscan/strscan/test/strscan/test_stringscanner.rb:974:in 'test_get_int' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch'

Check failure on line 974 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / windows-latest jruby

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner D:/a/strscan/strscan/test/strscan/test_stringscanner.rb:974:in 'test_get_int' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch'
assert_equal(6, s.get_int(2))
assert_equal(15, s.get_int(3))
end

def test_get_int_index_zero
s = create_string_scanner("42 abc")
s.scan(/(\d+)/)
assert_equal(42, s.get_int(0))

Check failure on line 982 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / macos-latest truffleruby-head

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /Users/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:982:in 'StringScannerTests#test_get_int_index_zero' <internal:core> core/throw_catch.rb:36:in 'Kernel#catch' <internal:core> core/throw_catch.rb:36:in 'Kernel#catch'

Check failure on line 982 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / ubuntu-latest truffleruby-head

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /home/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:982:in 'StringScannerTests#test_get_int_index_zero' <internal:core> core/throw_catch.rb:36:in 'Kernel#catch' <internal:core> core/throw_catch.rb:36:in 'Kernel#catch'

Check failure on line 982 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / macos-latest jruby-head

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /Users/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:982:in 'test_get_int_index_zero' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch'

Check failure on line 982 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / macos-latest jruby

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /Users/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:982:in 'test_get_int_index_zero' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch'

Check failure on line 982 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / ubuntu-latest jruby-9.4

Error

NoMethodError: undefined method `get_int' for #<StringScanner 2/6 "42" @ " abc"> Did you mean? get_byte /home/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:982:in `test_get_int_index_zero' org/jruby/RubyKernel.java:1426:in `catch' org/jruby/RubyKernel.java:1421:in `catch' org/jruby/RubyArray.java:2018:in `each' org/jruby/RubyArray.java:2018:in `each' org/jruby/RubyKernel.java:1426:in `catch' org/jruby/RubyKernel.java:1421:in `catch'

Check failure on line 982 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / ubuntu-latest jruby-head

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /home/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:982:in 'test_get_int_index_zero' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch'

Check failure on line 982 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / ubuntu-latest jruby

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /home/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:982:in 'test_get_int_index_zero' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch'

Check failure on line 982 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / windows-latest jruby-head

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner D:/a/strscan/strscan/test/strscan/test_stringscanner.rb:982:in 'test_get_int_index_zero' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch'

Check failure on line 982 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / windows-latest jruby

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner D:/a/strscan/strscan/test/strscan/test_stringscanner.rb:982:in 'test_get_int_index_zero' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch'
end

def test_get_int_negative_index
s = create_string_scanner("2024-06-15")
s.scan(/(\d{4})-(\d{2})-(\d{2})/)
assert_equal(15, s.get_int(-1))

Check failure on line 988 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / macos-latest truffleruby-head

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /Users/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:988:in 'StringScannerTests#test_get_int_negative_index' <internal:core> core/throw_catch.rb:36:in 'Kernel#catch' <internal:core> core/throw_catch.rb:36:in 'Kernel#catch'

Check failure on line 988 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / ubuntu-latest truffleruby-head

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /home/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:988:in 'StringScannerTests#test_get_int_negative_index' <internal:core> core/throw_catch.rb:36:in 'Kernel#catch' <internal:core> core/throw_catch.rb:36:in 'Kernel#catch'

Check failure on line 988 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / macos-latest jruby-head

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /Users/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:988:in 'test_get_int_negative_index' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch'

Check failure on line 988 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / macos-latest jruby

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /Users/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:988:in 'test_get_int_negative_index' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch'

Check failure on line 988 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / ubuntu-latest jruby-9.4

Error

NoMethodError: undefined method `get_int' for #<StringScanner fin> Did you mean? get_byte /home/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:988:in `test_get_int_negative_index' org/jruby/RubyKernel.java:1426:in `catch' org/jruby/RubyKernel.java:1421:in `catch' org/jruby/RubyArray.java:2018:in `each' org/jruby/RubyArray.java:2018:in `each' org/jruby/RubyKernel.java:1426:in `catch' org/jruby/RubyKernel.java:1421:in `catch'

Check failure on line 988 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / ubuntu-latest jruby-head

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /home/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:988:in 'test_get_int_negative_index' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch'

Check failure on line 988 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / ubuntu-latest jruby

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /home/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:988:in 'test_get_int_negative_index' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch'

Check failure on line 988 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / windows-latest jruby-head

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner D:/a/strscan/strscan/test/strscan/test_stringscanner.rb:988:in 'test_get_int_negative_index' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch'

Check failure on line 988 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / windows-latest jruby

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner D:/a/strscan/strscan/test/strscan/test_stringscanner.rb:988:in 'test_get_int_negative_index' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch'
assert_equal(6, s.get_int(-2))
assert_equal(2024, s.get_int(-3))
end

def test_get_int_no_match
s = create_string_scanner("abc")
s.scan(/\d+/)
assert_nil(s.get_int(0))

Check failure on line 996 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / macos-latest truffleruby-head

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /Users/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:996:in 'StringScannerTests#test_get_int_no_match' <internal:core> core/throw_catch.rb:36:in 'Kernel#catch' <internal:core> core/throw_catch.rb:36:in 'Kernel#catch'

Check failure on line 996 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / ubuntu-latest truffleruby-head

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /home/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:996:in 'StringScannerTests#test_get_int_no_match' <internal:core> core/throw_catch.rb:36:in 'Kernel#catch' <internal:core> core/throw_catch.rb:36:in 'Kernel#catch'

Check failure on line 996 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / macos-latest jruby-head

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /Users/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:996:in 'test_get_int_no_match' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch'

Check failure on line 996 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / macos-latest jruby

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /Users/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:996:in 'test_get_int_no_match' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch'

Check failure on line 996 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / ubuntu-latest jruby-9.4

Error

NoMethodError: undefined method `get_int' for #<StringScanner 0/3 @ "abc"> Did you mean? get_byte /home/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:996:in `test_get_int_no_match' org/jruby/RubyKernel.java:1426:in `catch' org/jruby/RubyKernel.java:1421:in `catch' org/jruby/RubyArray.java:2018:in `each' org/jruby/RubyArray.java:2018:in `each' org/jruby/RubyKernel.java:1426:in `catch' org/jruby/RubyKernel.java:1421:in `catch'

Check failure on line 996 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / ubuntu-latest jruby-head

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /home/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:996:in 'test_get_int_no_match' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch'

Check failure on line 996 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / ubuntu-latest jruby

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /home/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:996:in 'test_get_int_no_match' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch'

Check failure on line 996 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / windows-latest jruby-head

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner D:/a/strscan/strscan/test/strscan/test_stringscanner.rb:996:in 'test_get_int_no_match' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch'

Check failure on line 996 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / windows-latest jruby

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner D:/a/strscan/strscan/test/strscan/test_stringscanner.rb:996:in 'test_get_int_no_match' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch'
end

def test_get_int_before_match
s = create_string_scanner("abc")
assert_nil(s.get_int(0))

Check failure on line 1001 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / macos-latest truffleruby-head

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /Users/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:1001:in 'StringScannerTests#test_get_int_before_match' <internal:core> core/throw_catch.rb:36:in 'Kernel#catch' <internal:core> core/throw_catch.rb:36:in 'Kernel#catch'

Check failure on line 1001 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / macos-latest truffleruby-head

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /Users/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:1001:in 'StringScannerTests#test_get_int_before_match' <internal:core> core/throw_catch.rb:36:in 'Kernel#catch' <internal:core> core/throw_catch.rb:36:in 'Kernel#catch'

Check failure on line 1001 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / ubuntu-latest truffleruby-head

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /home/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:1001:in 'StringScannerTests#test_get_int_before_match' <internal:core> core/throw_catch.rb:36:in 'Kernel#catch' <internal:core> core/throw_catch.rb:36:in 'Kernel#catch'

Check failure on line 1001 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / ubuntu-latest truffleruby-head

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /home/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:1001:in 'StringScannerTests#test_get_int_before_match' <internal:core> core/throw_catch.rb:36:in 'Kernel#catch' <internal:core> core/throw_catch.rb:36:in 'Kernel#catch'

Check failure on line 1001 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / macos-latest jruby-head

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /Users/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:1001:in 'test_get_int_before_match' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch'

Check failure on line 1001 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / macos-latest jruby-head

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /Users/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:1001:in 'test_get_int_before_match' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch'

Check failure on line 1001 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / macos-latest jruby

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /Users/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:1001:in 'test_get_int_before_match' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch'

Check failure on line 1001 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / macos-latest jruby

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /Users/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:1001:in 'test_get_int_before_match' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch'

Check failure on line 1001 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / ubuntu-latest jruby-9.4

Error

NoMethodError: undefined method `get_int' for #<StringScanner 0/3 @ "abc"> Did you mean? get_byte /home/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:1001:in `test_get_int_before_match' org/jruby/RubyKernel.java:1426:in `catch' org/jruby/RubyKernel.java:1421:in `catch' org/jruby/RubyArray.java:2018:in `each' org/jruby/RubyArray.java:2018:in `each' org/jruby/RubyKernel.java:1426:in `catch' org/jruby/RubyKernel.java:1421:in `catch'

Check failure on line 1001 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / ubuntu-latest jruby-9.4

Error

NoMethodError: undefined method `get_int' for #<StringScanner 0/3 @ "abc"> Did you mean? get_byte /home/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:1001:in `test_get_int_before_match' org/jruby/RubyKernel.java:1426:in `catch' org/jruby/RubyKernel.java:1421:in `catch' org/jruby/RubyArray.java:2018:in `each' org/jruby/RubyArray.java:2018:in `each' org/jruby/RubyKernel.java:1426:in `catch' org/jruby/RubyKernel.java:1421:in `catch'

Check failure on line 1001 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / ubuntu-latest jruby-head

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /home/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:1001:in 'test_get_int_before_match' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch'

Check failure on line 1001 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / ubuntu-latest jruby-head

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /home/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:1001:in 'test_get_int_before_match' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch'

Check failure on line 1001 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / ubuntu-latest jruby

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /home/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:1001:in 'test_get_int_before_match' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch'

Check failure on line 1001 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / ubuntu-latest jruby

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /home/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:1001:in 'test_get_int_before_match' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch'

Check failure on line 1001 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / windows-latest jruby-head

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner D:/a/strscan/strscan/test/strscan/test_stringscanner.rb:1001:in 'test_get_int_before_match' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch'

Check failure on line 1001 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / windows-latest jruby-head

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner D:/a/strscan/strscan/test/strscan/test_stringscanner.rb:1001:in 'test_get_int_before_match' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch'

Check failure on line 1001 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / windows-latest jruby

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner D:/a/strscan/strscan/test/strscan/test_stringscanner.rb:1001:in 'test_get_int_before_match' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch'

Check failure on line 1001 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / windows-latest jruby

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner D:/a/strscan/strscan/test/strscan/test_stringscanner.rb:1001:in 'test_get_int_before_match' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch'
end

def test_get_int_index_out_of_range
s = create_string_scanner("42")
s.scan(/(\d+)/)
assert_nil(s.get_int(2))

Check failure on line 1007 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / macos-latest truffleruby-head

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /Users/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:1007:in 'StringScannerTests#test_get_int_index_out_of_range' <internal:core> core/throw_catch.rb:36:in 'Kernel#catch' <internal:core> core/throw_catch.rb:36:in 'Kernel#catch'

Check failure on line 1007 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / macos-latest truffleruby-head

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /Users/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:1007:in 'StringScannerTests#test_get_int_index_out_of_range' <internal:core> core/throw_catch.rb:36:in 'Kernel#catch' <internal:core> core/throw_catch.rb:36:in 'Kernel#catch'

Check failure on line 1007 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / ubuntu-latest truffleruby-head

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /home/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:1007:in 'StringScannerTests#test_get_int_index_out_of_range' <internal:core> core/throw_catch.rb:36:in 'Kernel#catch' <internal:core> core/throw_catch.rb:36:in 'Kernel#catch'

Check failure on line 1007 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / ubuntu-latest truffleruby-head

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /home/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:1007:in 'StringScannerTests#test_get_int_index_out_of_range' <internal:core> core/throw_catch.rb:36:in 'Kernel#catch' <internal:core> core/throw_catch.rb:36:in 'Kernel#catch'

Check failure on line 1007 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / macos-latest jruby-head

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /Users/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:1007:in 'test_get_int_index_out_of_range' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch'

Check failure on line 1007 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / macos-latest jruby-head

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /Users/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:1007:in 'test_get_int_index_out_of_range' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch'

Check failure on line 1007 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / macos-latest jruby

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /Users/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:1007:in 'test_get_int_index_out_of_range' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch'

Check failure on line 1007 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / macos-latest jruby

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /Users/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:1007:in 'test_get_int_index_out_of_range' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch'

Check failure on line 1007 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / ubuntu-latest jruby-9.4

Error

NoMethodError: undefined method `get_int' for #<StringScanner fin> Did you mean? get_byte /home/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:1007:in `test_get_int_index_out_of_range' org/jruby/RubyKernel.java:1426:in `catch' org/jruby/RubyKernel.java:1421:in `catch' org/jruby/RubyArray.java:2018:in `each' org/jruby/RubyArray.java:2018:in `each' org/jruby/RubyKernel.java:1426:in `catch' org/jruby/RubyKernel.java:1421:in `catch'

Check failure on line 1007 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / ubuntu-latest jruby-9.4

Error

NoMethodError: undefined method `get_int' for #<StringScanner fin> Did you mean? get_byte /home/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:1007:in `test_get_int_index_out_of_range' org/jruby/RubyKernel.java:1426:in `catch' org/jruby/RubyKernel.java:1421:in `catch' org/jruby/RubyArray.java:2018:in `each' org/jruby/RubyArray.java:2018:in `each' org/jruby/RubyKernel.java:1426:in `catch' org/jruby/RubyKernel.java:1421:in `catch'

Check failure on line 1007 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / ubuntu-latest jruby-head

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /home/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:1007:in 'test_get_int_index_out_of_range' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch'

Check failure on line 1007 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / ubuntu-latest jruby-head

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /home/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:1007:in 'test_get_int_index_out_of_range' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch'

Check failure on line 1007 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / ubuntu-latest jruby

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /home/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:1007:in 'test_get_int_index_out_of_range' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch'

Check failure on line 1007 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / ubuntu-latest jruby

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /home/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:1007:in 'test_get_int_index_out_of_range' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch'

Check failure on line 1007 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / windows-latest jruby-head

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner D:/a/strscan/strscan/test/strscan/test_stringscanner.rb:1007:in 'test_get_int_index_out_of_range' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch'

Check failure on line 1007 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / windows-latest jruby-head

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner D:/a/strscan/strscan/test/strscan/test_stringscanner.rb:1007:in 'test_get_int_index_out_of_range' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch'

Check failure on line 1007 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / windows-latest jruby

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner D:/a/strscan/strscan/test/strscan/test_stringscanner.rb:1007:in 'test_get_int_index_out_of_range' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch'

Check failure on line 1007 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / windows-latest jruby

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner D:/a/strscan/strscan/test/strscan/test_stringscanner.rb:1007:in 'test_get_int_index_out_of_range' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch'
assert_nil(s.get_int(100))
assert_nil(s.get_int(-3))
end

def test_get_int_optional_group_not_matched
s = create_string_scanner("2024-06")
s.scan(/(\d{4})-(\d{2})(-(\d{2}))?/)
assert_equal(2024, s.get_int(1))

Check failure on line 1015 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / macos-latest truffleruby-head

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /Users/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:1015:in 'StringScannerTests#test_get_int_optional_group_not_matched' <internal:core> core/throw_catch.rb:36:in 'Kernel#catch' <internal:core> core/throw_catch.rb:36:in 'Kernel#catch'

Check failure on line 1015 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / ubuntu-latest truffleruby-head

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /home/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:1015:in 'StringScannerTests#test_get_int_optional_group_not_matched' <internal:core> core/throw_catch.rb:36:in 'Kernel#catch' <internal:core> core/throw_catch.rb:36:in 'Kernel#catch'

Check failure on line 1015 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / macos-latest jruby-head

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /Users/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:1015:in 'test_get_int_optional_group_not_matched' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch'

Check failure on line 1015 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / macos-latest jruby

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /Users/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:1015:in 'test_get_int_optional_group_not_matched' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch'

Check failure on line 1015 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / ubuntu-latest jruby-9.4

Error

NoMethodError: undefined method `get_int' for #<StringScanner fin> Did you mean? get_byte /home/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:1015:in `test_get_int_optional_group_not_matched' org/jruby/RubyKernel.java:1426:in `catch' org/jruby/RubyKernel.java:1421:in `catch' org/jruby/RubyArray.java:2018:in `each' org/jruby/RubyArray.java:2018:in `each' org/jruby/RubyKernel.java:1426:in `catch' org/jruby/RubyKernel.java:1421:in `catch'

Check failure on line 1015 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / ubuntu-latest jruby-head

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /home/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:1015:in 'test_get_int_optional_group_not_matched' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch'

Check failure on line 1015 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / ubuntu-latest jruby

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner /home/runner/work/strscan/strscan/test/strscan/test_stringscanner.rb:1015:in 'test_get_int_optional_group_not_matched' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch'

Check failure on line 1015 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / windows-latest jruby-head

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner D:/a/strscan/strscan/test/strscan/test_stringscanner.rb:1015:in 'test_get_int_optional_group_not_matched' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyArrayNative.java:1729:in 'each' org/jruby/RubyKernel.java:1427:in 'catch' org/jruby/RubyKernel.java:1422:in 'catch'

Check failure on line 1015 in test/strscan/test_stringscanner.rb

View workflow job for this annotation

GitHub Actions / windows-latest jruby

Error

NoMethodError: undefined method 'get_int' for an instance of StringScanner D:/a/strscan/strscan/test/strscan/test_stringscanner.rb:1015:in 'test_get_int_optional_group_not_matched' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyArray.java:2093:in 'each' org/jruby/RubyKernel.java:1407:in 'catch' org/jruby/RubyKernel.java:1402:in 'catch'
assert_equal(6, s.get_int(2))
assert_nil(s.get_int(4))
end

def test_scan_integer
s = create_string_scanner('abc')
assert_equal(3, s.match?(/(?<a>abc)/)) # set named_captures
Expand Down