ruby-changes:11692
From: yugui <ko1@a...>
Date: Mon, 4 May 2009 21:30:49 +0900 (JST)
Subject: [ruby-changes:11692] Ruby:r23332 (ruby_1_9_1): merges r23155 and r23158 from trunk into ruby_1_9_1.
yugui 2009-05-04 21:29:44 +0900 (Mon, 04 May 2009) New Revision: 23332 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=23332 Log: 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]. Modified files: branches/ruby_1_9_1/ChangeLog branches/ruby_1_9_1/string.c branches/ruby_1_9_1/test/ruby/test_string.rb Index: ruby_1_9_1/ChangeLog =================================================================== --- ruby_1_9_1/ChangeLog (revision 23331) +++ ruby_1_9_1/ChangeLog (revision 23332) @@ -1,3 +1,7 @@ +Wed Apr 8 17:29:29 2009 NARUSE, Yui <naruse@r...> + + * string.c (rb_str_chop_bang): reset coderange. [ruby-core:23155] + Tue Apr 7 13:14:32 2009 Nobuyoshi Nakada <nobu@r...> * configure.in (LIBRUBY_DLDFLAGS): compatibility version is Index: ruby_1_9_1/string.c =================================================================== --- ruby_1_9_1/string.c (revision 23331) +++ ruby_1_9_1/string.c (revision 23332) @@ -5811,7 +5811,7 @@ { 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'; Index: ruby_1_9_1/test/ruby/test_string.rb =================================================================== --- ruby_1_9_1/test/ruby/test_string.rb (revision 23331) +++ ruby_1_9_1/test/ruby/test_string.rb (revision 23332) @@ -405,6 +405,7 @@ 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 @@ 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!) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/