MatchData#begin('string') and MatchData#end('string') should raise TypeError
----------------------------------------------------------------------------
Key: JRUBY-3044
URL: http://jira.codehaus.org/browse/JRUBY-3044
Project: JRuby
Issue Type: Bug
Components: Core Classes/Modules
Environment: OS X, jruby 1.1.4 (ruby 1.8.6 patchlevel 114) (2008-10-04
rev 7830) [i386-java]
Reporter: Daniel Berger
Priority: Minor
Fix For: JRuby 1.1.5
MatchData#begin('test') and MatchData#end('test') each raise a TypeError in MRI
(as does any non-Fixnum). In Jruby they raise an IndexError.
In MRI:
{noformat}
irb(main):001:0> s = 'THX1138'
=> "THX1138"
irb(main):002:0> regex = /(.)(.)(\d+)(\d)/
=> /(.)(.)(\d+)(\d)/
irb(main):003:0> match = regex.match(s)
=> #<MatchData:0x583310>
irb(main):004:0> match.begin('test')
TypeError: can't convert String into Integer
from (irb):4:in `begin'
from (irb):4
irb(main):005:0> match.end('test')
TypeError: can't convert String into Integer
from (irb):5:in `end'
from (irb):5
{noformat}
JRuby returns:
{noformat}
irb(main):022:0> match.begin('test')
IndexError: undefined name <test> reference
{noformat}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email