diff options
-rw-r--r-- | ext/strscan/strscan.c | 5 | ||||
-rw-r--r-- | test/strscan/test_stringscanner.rb | 6 |
2 files changed, 10 insertions, 1 deletions
@@ -2211,7 +2211,10 @@ named_captures_iter(const OnigUChar *name, VALUE value = RUBY_Qnil; int i; for (i = 0; i < back_num; i++) { - value = strscan_aref(data->self, INT2NUM(back_refs[i])); } rb_hash_aset(data->captures, key, value); return 0; @@ -967,6 +967,12 @@ module StringScannerTests assert_equal({}, scan.named_captures) end def test_scan_integer s = create_string_scanner('abc') assert_equal(3, s.match?(/(?<a>abc)/)) # set named_captures |