mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
merges r24679 from trunk into ruby_1_9_1.
-- * ext/strscan/strscan.c (strscan_set_string): set string should not be dupped or frozen, because freezing it causes #concat method failure, and unnecessary to dup without freezing. a patch from Aaron Patterson at [ruby-core:25145]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@25546 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
dbddc90b89
commit
3750847f55
4 changed files with 29 additions and 3 deletions
|
|
@ -1,3 +1,10 @@
|
|||
Thu Aug 27 08:16:34 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* ext/strscan/strscan.c (strscan_set_string): set string should not be
|
||||
dupped or frozen, because freezing it causes #concat method failure,
|
||||
and unnecessary to dup without freezing. a patch from Aaron
|
||||
Patterson at [ruby-core:25145].
|
||||
|
||||
Wed Aug 26 12:36:58 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* vm.c (collect_local_variables_in_env): skips internal variables.
|
||||
|
|
|
|||
|
|
@ -321,8 +321,7 @@ strscan_set_string(VALUE self, VALUE str)
|
|||
|
||||
Data_Get_Struct(self, struct strscanner, p);
|
||||
StringValue(str);
|
||||
p->str = rb_str_dup(str);
|
||||
rb_obj_freeze(p->str);
|
||||
p->str = str;
|
||||
p->curr = 0;
|
||||
CLEAR_MATCH_STATUS(p);
|
||||
return str;
|
||||
|
|
|
|||
|
|
@ -168,6 +168,26 @@ class TestStringScanner < Test::Unit::TestCase
|
|||
assert_equal 0, s.pos
|
||||
end
|
||||
|
||||
def test_string_set_is_equal
|
||||
name = 'tenderlove'
|
||||
|
||||
s = StringScanner.new(name)
|
||||
assert_equal name.object_id, s.string.object_id
|
||||
|
||||
s.string = name
|
||||
assert_equal name.object_id, s.string.object_id
|
||||
end
|
||||
|
||||
def test_string_append
|
||||
s = StringScanner.new('tender')
|
||||
s << 'love'
|
||||
assert_equal 'tenderlove', s.string
|
||||
|
||||
s.string = 'tender'
|
||||
s << 'love'
|
||||
assert_equal 'tenderlove', s.string
|
||||
end
|
||||
|
||||
def test_pos
|
||||
s = StringScanner.new('test string')
|
||||
assert_equal 0, s.pos
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#define RUBY_VERSION "1.9.1"
|
||||
#define RUBY_PATCHLEVEL 304
|
||||
#define RUBY_PATCHLEVEL 305
|
||||
#define RUBY_VERSION_MAJOR 1
|
||||
#define RUBY_VERSION_MINOR 9
|
||||
#define RUBY_VERSION_TEENY 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue