* test/ruby/test_m17n_comb.rb (TestM17NComb::test_str_chomp): test

updated.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15644 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2008-02-29 14:57:04 +00:00
Родитель 21c9bd1b33
Коммит 99de7f24f7
3 изменённых файлов: 12 добавлений и 3 удалений

Просмотреть файл

@ -1,3 +1,8 @@
Fri Feb 29 23:14:38 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
* test/ruby/test_m17n_comb.rb (TestM17NComb::test_str_chomp): test
updated.
Fri Feb 29 20:58:09 2008 Yukihiro Matsumoto <matz@ruby-lang.org> Fri Feb 29 20:58:09 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
* test/ruby/test_iterator.rb (TestIterator::test_enumerator): * test/ruby/test_iterator.rb (TestIterator::test_enumerator):

Просмотреть файл

@ -5357,11 +5357,11 @@ rb_str_chomp_bang(int argc, VALUE *argv, VALUE str)
if (rslen == 1 && newline == '\n') if (rslen == 1 && newline == '\n')
goto smart_chomp; goto smart_chomp;
enc = rb_enc_check(str, rs);
if (is_broken_string(rs)) { if (is_broken_string(rs)) {
return Qnil; return Qnil;
} }
pp = e - rslen; pp = e - rslen;
enc = rb_enc_check(str, rs);
if (p[len-1] == newline && if (p[len-1] == newline &&
(rslen <= 1 || (rslen <= 1 ||
memcmp(RSTRING_PTR(rs), pp, rslen) == 0)) { memcmp(RSTRING_PTR(rs), pp, rslen) == 0)) {

Просмотреть файл

@ -720,8 +720,10 @@ class TestM17NComb < Test::Unit::TestCase
def test_str_chomp def test_str_chomp
combination(STRINGS, STRINGS) {|s1, s2| combination(STRINGS, STRINGS) {|s1, s2|
if !s1.ascii_only? && !s2.ascii_only? && s1.encoding != s2.encoding if !s1.ascii_only? && !s2.ascii_only? && !Encoding.compatible?(s1,s2)
assert_raise(ArgumentError) { s1.chomp(s2) } if s1.bytesize > s2.bytesize
assert_raise(ArgumentError) { s1.chomp(s2) }
end
next next
end end
t = enccall(s1, :chomp, s2) t = enccall(s1, :chomp, s2)
@ -1425,6 +1427,7 @@ class TestM17NComb < Test::Unit::TestCase
assert_equal(s1, doit.call) assert_equal(s1, doit.call)
next next
end end
assert(false, "test broken")
if !str_enc_compatible?(s1.gsub(r2, ''), s3) if !str_enc_compatible?(s1.gsub(r2, ''), s3)
assert_raise(ArgumentError, desc) { doit.call } assert_raise(ArgumentError, desc) { doit.call }
next next
@ -1479,6 +1482,7 @@ class TestM17NComb < Test::Unit::TestCase
assert_equal([s1, nil], doit.call) assert_equal([s1, nil], doit.call)
next next
end end
assert(false, "test broken")
if !str_enc_compatible?(s1.gsub(r2, ''), s3) if !str_enc_compatible?(s1.gsub(r2, ''), s3)
assert_raise(ArgumentError, desc) { doit.call } assert_raise(ArgumentError, desc) { doit.call }
next next