diff options
| author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-05-04 12:29:44 +0000 |
|---|---|---|
| committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-05-04 12:29:44 +0000 |
| commit | 5c34f89dfb2e051f49d98be460cb31f9a94de807 (patch) | |
| tree | e64125bea2f63555d1d9f1827199b494e1213186 | |
| parent | f8c7140aecec1b5581da73c9022934a04b77d641 (diff) | |
| download | ruby-5c34f89dfb2e051f49d98be460cb31f9a94de807.tar.gz ruby-5c34f89dfb2e051f49d98be460cb31f9a94de807.tar.xz ruby-5c34f89dfb2e051f49d98be460cb31f9a94de807.zip | |
merges r23155 and r23158 from trunk into ruby_1_9_1.
--
* string.c (rb_str_chop_bang): reset coderange. [ruby-core:23155]
--
* test/ruby/test_string.rb (test_chop, test_chop!): tests for [ruby-core:23155].
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@23332 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 4 | ||||
| -rw-r--r-- | string.c | 2 | ||||
| -rw-r--r-- | test/ruby/test_string.rb | 5 |
3 files changed, 10 insertions, 1 deletions
@@ -1,3 +1,7 @@ +Wed Apr 8 17:29:29 2009 NARUSE, Yui <naruse@ruby-lang.org> + + * string.c (rb_str_chop_bang): reset coderange. [ruby-core:23155] + Tue Apr 7 13:14:32 2009 Nobuyoshi Nakada <nobu@ruby-lang.org> * configure.in (LIBRUBY_DLDFLAGS): compatibility version is @@ -5811,7 +5811,7 @@ rb_str_chop_bang(VALUE str) { if (RSTRING_LEN(str) > 0) { long len; - str_modify_keep_cr(str); + rb_str_modify(str); len = chopped_length(str); STR_SET_LEN(str, len); RSTRING_PTR(str)[len] = '\0'; diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb index f3aa45a73..7fa2ead9b 100644 --- a/test/ruby/test_string.rb +++ b/test/ruby/test_string.rb @@ -405,6 +405,7 @@ class TestString < Test::Unit::TestCase assert_equal(S("hello\n"), S("hello\n\r").chop) assert_equal(S(""), S("\r\n").chop) assert_equal(S(""), S("").chop) + assert_equal(S("a").hash, S("a\u00d8").chop.hash) end def test_chop! @@ -423,6 +424,10 @@ class TestString < Test::Unit::TestCase a = S("").chop! assert_nil(a) + a = S("a\u00d8") + a.chop! + assert_equal(S("a").hash, a.hash) + a = S("hello\n") b = a.dup assert_equal(S("hello"), a.chop!) |
