String#initialize and String#replace on frozen strings behave incompatibly with
MRI
-----------------------------------------------------------------------------------
Key: JRUBY-1723
URL: http://jira.codehaus.org/browse/JRUBY-1723
Project: JRuby
Issue Type: Bug
Components: Core Classes/Modules
Affects Versions: JRuby 1.x
Environment: Latest JRuby 1.1b1 from trunk
Reporter: Vladimir Sizikov
Priority: Minor
Attachments: string_replace.diff
Ruby 1.8.6 and Ruby 1.9 do not throw TypeError when
a = "hello".freeze
a.replace(a)
since no actual change is done.
JRuby throws TypeError always.
This causes 2 spec failures from Rubinius:
1)
String#replace raises a TypeError if self is frozen FAILED
can't modify frozen stringString
/opt/work/rubinius/./spec/core/string/replace_spec.rb:36
/opt/work/rubinius/./spec/core/string/replace_spec.rb:36:in `it'
/opt/work/rubinius/spec/mini_rspec.rb:359:in `it'
/opt/work/rubinius/./spec/core/string/replace_spec.rb:36:in `it'
/opt/work/rubinius/./spec/core/string/replace_spec.rb:36:in `compliant'
/opt/work/rubinius/./spec/core/string/../../spec_helper.rb:76:in `compliant'
/opt/work/rubinius/./spec/core/string/replace_spec.rb:36:in `describe'
/opt/work/rubinius/spec/mini_rspec.rb:410:in `describe'
/opt/work/rubinius/./spec/core/string/replace_spec.rb:4:in `describe'
/opt/work/rubinius/./spec/core/string/replace_spec.rb:4:in `load'
tmp/last_mspec.rb:13:in `load'
tmp/last_mspec.rb:1:in `each'
tmp/last_mspec.rb:7:in `each'
The following trivial patch corrects the problem and removes two spec failures.
--
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