Regression: String#match after String#gsub (and vice versa) with the same 
string work incorrectly
-------------------------------------------------------------------------------------------------

                 Key: JRUBY-1778
                 URL: http://jira.codehaus.org/browse/JRUBY-1778
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules
         Environment: Latest JRuby 1.1b1 from trunk.
            Reporter: Vladimir Sizikov


Consider the following example:
{noformat}
p "hello.".gsub('.', "!")
p "hello".match('.')
{noformat}

MRI produces:
"hello!"
#<MatchData:0x174219d>

JRuby produces
"hello!"
nil

This problem also leads to one Rubinius spec failure, when all String tests are 
executed in one run:
String#match tries to convert pattern to a string via to_str FAILED
undefined method `[]' for nil:NilClass:
/opt/work/rubinius/./spec/core/string/match_spec.rb:47:in `method_missing'
/opt/work/rubinius/./spec/core/string/match_spec.rb:42:in `call'
./mspec/runner/runner.rb:136:in `describe'
./mspec/runner/runner.rb:135:in `each'
./mspec/runner/runner.rb:130:in `describe'
./mspec/runner/runner.rb:135:in `describe'
/opt/work/rubinius/./spec/core/string/match_spec.rb:37:in `describe'
/opt/work/rubinius/./spec/core/string/match_spec.rb:37:in `load'
tmp/last_mspec.rb:19:in `load'
tmp/last_mspec.rb:13:in `each'
tmp/last_mspec.rb:13:in `each'

The root cause of the problem is identified, and the patch is going to be 
submitted shortly, along with regression test.
(The root cause is that patternCache is used incorrectly and mixes quoted and 
non-quoted strings).


-- 
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

Reply via email to