mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* string.c (rb_str_buf_append): fix append itself.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14941 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
f07c8e6413
commit
fc5a26c2d4
3 changed files with 17 additions and 1 deletions
|
@ -1,3 +1,7 @@
|
|||
Tue Jan 8 07:56:11 2008 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* string.c (rb_str_buf_append): fix append itself.
|
||||
|
||||
Tue Jan 8 01:13:50 2008 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* string.c (STR_ENC_GET): defined. same as rb_enc_get without
|
||||
|
|
8
string.c
8
string.c
|
@ -1166,7 +1166,13 @@ rb_enc_str_buf_cat(VALUE str, const char *ptr, long len, rb_encoding *ptr_enc)
|
|||
VALUE
|
||||
rb_str_buf_append(VALUE str, VALUE str2)
|
||||
{
|
||||
int str2_cr = ENC_CODERANGE(str2);
|
||||
int str2_cr;
|
||||
|
||||
if (str == str2) {
|
||||
str2 = rb_str_dup(str2);
|
||||
}
|
||||
|
||||
str2_cr = ENC_CODERANGE(str2);
|
||||
|
||||
rb_enc_cr_str_buf_cat(str, RSTRING_PTR(str2), RSTRING_LEN(str2),
|
||||
ENCODING_GET(str2), str2_cr, &str2_cr);
|
||||
|
|
|
@ -170,6 +170,12 @@ class TestString < Test::Unit::TestCase
|
|||
def test_LSHIFT # '<<'
|
||||
assert_equal(S("world!"), S("world") << 33)
|
||||
assert_equal(S("world!"), S("world") << S('!'))
|
||||
|
||||
s = "a"
|
||||
10.times {|i|
|
||||
s << s
|
||||
assert_equal("a" * (2<<i), s)
|
||||
}
|
||||
end
|
||||
|
||||
def test_MATCH # '=~'
|
||||
|
|
Loading…
Add table
Reference in a new issue