mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* string.c (tr_trans): wrong encoding check for tree strings.
* test/ruby/test_m17n.rb (TestM17N::test_tr_s): "invalid mbstring sequence" is not an error to be tested. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14369 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
5c04ed459b
commit
cfb91bc2f5
4 changed files with 20 additions and 9 deletions
|
@ -1,3 +1,10 @@
|
|||
Fri Dec 21 00:26:39 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* string.c (tr_trans): wrong encoding check for tree strings.
|
||||
|
||||
* test/ruby/test_m17n.rb (TestM17N::test_tr_s): "invalid mbstring
|
||||
sequence" is not an error to be tested.
|
||||
|
||||
Thu Dec 20 19:29:07 2007 Shugo Maeda <shugo@ruby-lang.org>
|
||||
|
||||
* lib/net/imap.rb (initialize): the second argument is an option
|
||||
|
|
12
string.c
12
string.c
|
@ -3453,7 +3453,7 @@ static VALUE
|
|||
tr_trans(VALUE str, VALUE src, VALUE repl, int sflag)
|
||||
{
|
||||
SIGNED_VALUE trans[256];
|
||||
rb_encoding *enc;
|
||||
rb_encoding *enc, *e1, *e2;
|
||||
struct tr trsrc, trrepl;
|
||||
int cflag = 0;
|
||||
int c, last = 0, modify = 0, i;
|
||||
|
@ -3471,9 +3471,13 @@ tr_trans(VALUE str, VALUE src, VALUE repl, int sflag)
|
|||
if (RSTRING_LEN(repl) == 0) {
|
||||
return rb_str_delete_bang(1, &src, str);
|
||||
}
|
||||
enc = rb_enc_check(str, src);
|
||||
if (rb_enc_check(str, repl) != enc) {
|
||||
rb_raise(rb_eArgError, "character encodings differ");
|
||||
e1 = rb_enc_check(str, src);
|
||||
e2 = rb_enc_check(str, repl);
|
||||
if (e1 == e2) {
|
||||
enc = e1;
|
||||
}
|
||||
else {
|
||||
enc = rb_enc_check(src, repl);
|
||||
}
|
||||
trrepl.p = RSTRING_PTR(repl);
|
||||
trrepl.pend = trrepl.p + RSTRING_LEN(repl);
|
||||
|
|
|
@ -1643,7 +1643,7 @@ class TestM17N < Test::Unit::TestCase
|
|||
#puts "#{encdump s1}.tr_s(#{encdump s2}, #{encdump s3})"
|
||||
t = s1.tr_s(s2, s3)
|
||||
rescue ArgumentError
|
||||
e = $!
|
||||
e = $! unless /mbstring sequence/ =~ $!.message
|
||||
end
|
||||
if e
|
||||
encs = []
|
||||
|
@ -1651,7 +1651,7 @@ class TestM17N < Test::Unit::TestCase
|
|||
encs << s2.encoding if !is_ascii_only?(s2)
|
||||
encs << s3.encoding if !is_ascii_only?(s3)
|
||||
encs.uniq!
|
||||
#p e, encs
|
||||
#p e, encs,
|
||||
assert(1 < encs.length, "#{encdump s1}.tr_s(#{encdump s2}, #{encdump s3})")
|
||||
end
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#define RUBY_VERSION "1.9.0"
|
||||
#define RUBY_RELEASE_DATE "2007-12-20"
|
||||
#define RUBY_RELEASE_DATE "2007-12-21"
|
||||
#define RUBY_VERSION_CODE 190
|
||||
#define RUBY_RELEASE_CODE 20071220
|
||||
#define RUBY_RELEASE_CODE 20071221
|
||||
#define RUBY_PATCHLEVEL 0
|
||||
|
||||
#define RUBY_VERSION_MAJOR 1
|
||||
|
@ -9,7 +9,7 @@
|
|||
#define RUBY_VERSION_TEENY 0
|
||||
#define RUBY_RELEASE_YEAR 2007
|
||||
#define RUBY_RELEASE_MONTH 12
|
||||
#define RUBY_RELEASE_DAY 20
|
||||
#define RUBY_RELEASE_DAY 21
|
||||
|
||||
#ifdef RUBY_EXTERN
|
||||
RUBY_EXTERN const char ruby_version[];
|
||||
|
|
Loading…
Reference in a new issue