* string.c (tr_trans): should associate new encoding if modified.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14555 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c749064f9f
commit
19cf57f21c
@ -1,3 +1,7 @@
|
|||||||
|
Mon Dec 24 05:13:04 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* string.c (tr_trans): should associate new encoding if modified.
|
||||||
|
|
||||||
Mon Dec 24 04:04:12 2007 GOTOU Yuuzou <gotoyuzo@notwork.org>
|
Mon Dec 24 04:04:12 2007 GOTOU Yuuzou <gotoyuzo@notwork.org>
|
||||||
|
|
||||||
* test/net/http/test_https.rb: should rescue LoadError.
|
* test/net/http/test_https.rb: should rescue LoadError.
|
||||||
|
5
string.c
5
string.c
@ -3655,7 +3655,10 @@ tr_trans(VALUE str, VALUE src, VALUE repl, int sflag)
|
|||||||
RSTRING(str)->as.heap.aux.capa = max;
|
RSTRING(str)->as.heap.aux.capa = max;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (modify) return str;
|
if (modify) {
|
||||||
|
rb_enc_associate(str, enc);
|
||||||
|
return str;
|
||||||
|
}
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1763,11 +1763,7 @@ class TestM17N < Test::Unit::TestCase
|
|||||||
next
|
next
|
||||||
end
|
end
|
||||||
t = s1.tr(s2, s3)
|
t = s1.tr(s2, s3)
|
||||||
if s3.empty?
|
assert_operator(s1.length, :>=, t.length, desc)
|
||||||
assert_equal(0, t.length, desc)
|
|
||||||
next
|
|
||||||
end
|
|
||||||
assert_equal(s1.length, t.length, desc)
|
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1799,12 +1795,7 @@ class TestM17N < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
t = nil
|
t = nil
|
||||||
assert_nothing_raised(desc) { t = s1.tr_s(s2, s3) }
|
assert_nothing_raised(desc) { t = s1.tr_s(s1, s3) }
|
||||||
|
|
||||||
if s3.empty?
|
|
||||||
assert_equal(0, t.length, desc)
|
|
||||||
next
|
|
||||||
end
|
|
||||||
assert_operator(s1.length, :>=, t.length, desc)
|
assert_operator(s1.length, :>=, t.length, desc)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user