ruby-changes:4154
From: ko1@a...
Date: Fri, 29 Feb 2008 23:57:33 +0900 (JST)
Subject: [ruby-changes:4154] matz - Ruby:r15644 (trunk): * test/ruby/test_m17n_comb.rb (TestM17NComb::test_str_chomp): test
matz 2008-02-29 23:57:04 +0900 (Fri, 29 Feb 2008)
New Revision: 15644
Modified files:
trunk/ChangeLog
trunk/string.c
trunk/test/ruby/test_m17n_comb.rb
Log:
* test/ruby/test_m17n_comb.rb (TestM17NComb::test_str_chomp): test
updated.
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/test/ruby/test_m17n_comb.rb?r1=15644&r2=15643&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/string.c?r1=15644&r2=15643&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=15644&r2=15643&diff_format=u
Index: ChangeLog
===================================================================
--- ChangeLog (revision 15643)
+++ ChangeLog (revision 15644)
@@ -1,3 +1,8 @@
+Fri Feb 29 23:14:38 2008 Yukihiro Matsumoto <matz@r...>
+
+ * test/ruby/test_m17n_comb.rb (TestM17NComb::test_str_chomp): test
+ updated.
+
Fri Feb 29 20:58:09 2008 Yukihiro Matsumoto <matz@r...>
* test/ruby/test_iterator.rb (TestIterator::test_enumerator):
Index: string.c
===================================================================
--- string.c (revision 15643)
+++ string.c (revision 15644)
@@ -5357,11 +5357,11 @@
if (rslen == 1 && newline == '\n')
goto smart_chomp;
+ enc = rb_enc_check(str, rs);
if (is_broken_string(rs)) {
return Qnil;
}
pp = e - rslen;
- enc = rb_enc_check(str, rs);
if (p[len-1] == newline &&
(rslen <= 1 ||
memcmp(RSTRING_PTR(rs), pp, rslen) == 0)) {
Index: test/ruby/test_m17n_comb.rb
===================================================================
--- test/ruby/test_m17n_comb.rb (revision 15643)
+++ test/ruby/test_m17n_comb.rb (revision 15644)
@@ -720,8 +720,10 @@
def test_str_chomp
combination(STRINGS, STRINGS) {|s1, s2|
- if !s1.ascii_only? && !s2.ascii_only? && s1.encoding != s2.encoding
- assert_raise(ArgumentError) { s1.chomp(s2) }
+ if !s1.ascii_only? && !s2.ascii_only? && !Encoding.compatible?(s1,s2)
+ if s1.bytesize > s2.bytesize
+ assert_raise(ArgumentError) { s1.chomp(s2) }
+ end
next
end
t = enccall(s1, :chomp, s2)
@@ -1425,6 +1427,7 @@
assert_equal(s1, doit.call)
next
end
+ assert(false, "test broken")
if !str_enc_compatible?(s1.gsub(r2, ''), s3)
assert_raise(ArgumentError, desc) { doit.call }
next
@@ -1479,6 +1482,7 @@
assert_equal([s1, nil], doit.call)
next
end
+ assert(false, "test broken")
if !str_enc_compatible?(s1.gsub(r2, ''), s3)
assert_raise(ArgumentError, desc) { doit.call }
next
--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/