diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-13 07:14:56 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-13 07:14:56 +0000 |
commit | 55c141c6247a4d8c052c0d57f59ddaa29e3e523a (patch) | |
tree | a7703ac9a54dd8ac5f9d44d0806c1c216d507c84 | |
parent | 090004886d24023af8fa32e3fe589340b31eb72c (diff) | |
download | ruby-55c141c6247a4d8c052c0d57f59ddaa29e3e523a.tar.gz |
* test/ruby/test_m17n.rb: follow EncodingCompatibilityError.
* test/ruby/test_mixed_unicode_escapes.rb: ditto.
* test/ruby/enc/test_utf16.rb: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18567 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | test/ruby/enc/test_utf16.rb | 20 | ||||
-rw-r--r-- | test/ruby/test_m17n.rb | 28 | ||||
-rw-r--r-- | test/ruby/test_mixed_unicode_escapes.rb | 4 |
4 files changed, 34 insertions, 26 deletions
@@ -1,3 +1,11 @@ +Wed Aug 13 16:13:58 2008 NARUSE, Yui <naruse@ruby-lang.org> + + * test/ruby/test_m17n.rb: follow EncodingCompatibilityError. + + * test/ruby/test_mixed_unicode_escapes.rb: ditto. + + * test/ruby/enc/test_utf16.rb: ditto. + Wed Aug 13 16:05:50 2008 Yukihiro Matsumoto <matz@ruby-lang.org> * time.c (time_cmp): retry with right hand operand if its not a diff --git a/test/ruby/enc/test_utf16.rb b/test/ruby/enc/test_utf16.rb index c10463b2b3..a7c735f436 100644 --- a/test/ruby/enc/test_utf16.rb +++ b/test/ruby/enc/test_utf16.rb @@ -137,19 +137,19 @@ EOT end def test_hex - assert_raise(ArgumentError) { + assert_raise(EncodingCompatibilityError) { "ff".encode("utf-16le").hex } - assert_raise(ArgumentError) { + assert_raise(EncodingCompatibilityError) { "ff".encode("utf-16be").hex } end def test_oct - assert_raise(ArgumentError) { + assert_raise(EncodingCompatibilityError) { "77".encode("utf-16le").oct } - assert_raise(ArgumentError) { + assert_raise(EncodingCompatibilityError) { "77".encode("utf-16be").oct } end @@ -157,7 +157,7 @@ EOT def test_count s1 = "aa".force_encoding("utf-16be") s2 = "aa" - assert_raise(ArgumentError, "#{encdump s1}.count(#{encdump s2})") { + assert_raise(EncodingCompatibilityError, "#{encdump s1}.count(#{encdump s2})") { s1.count(s2) } end @@ -165,7 +165,7 @@ EOT def test_plus s1 = "a".force_encoding("us-ascii") s2 = "aa".force_encoding("utf-16be") - assert_raise(ArgumentError, "#{encdump s1} + #{encdump s2}") { + assert_raise(EncodingCompatibilityError, "#{encdump s1} + #{encdump s2}") { s1 + s2 } end @@ -178,7 +178,7 @@ EOT def test_interpolation s = "aa".force_encoding("utf-16be") - assert_raise(ArgumentError, "\"a\#{#{encdump s}}\"") { + assert_raise(EncodingCompatibilityError, "\"a\#{#{encdump s}}\"") { "a#{s}" } end @@ -206,7 +206,7 @@ EOT def test_plus_nonempty s1 = "aa" s2 = "bb".force_encoding("utf-16be") - assert_raise(ArgumentError, "#{encdump s1} << #{encdump s2}") { + assert_raise(EncodingCompatibilityError, "#{encdump s1} << #{encdump s2}") { s1 + s2 } end @@ -230,7 +230,7 @@ EOT def test_concat_nonempty s1 = "aa" s2 = "bb".force_encoding("utf-16be") - assert_raise(ArgumentError, "#{encdump s1} << #{encdump s2}") { + assert_raise(EncodingCompatibilityError, "#{encdump s1} << #{encdump s2}") { s1 << s2 } end @@ -272,7 +272,7 @@ EOT s.gsub(Regexp.new(".".encode("utf-16be")), "xy") } s = "ab\0\ncd".force_encoding("utf-16be") - assert_raise(ArgumentError) { + assert_raise(EncodingCompatibilityError) { s.gsub(Regexp.new(".".encode("utf-16be")), "xy") } end diff --git a/test/ruby/test_m17n.rb b/test/ruby/test_m17n.rb index f01b838732..e82e04beb7 100644 --- a/test/ruby/test_m17n.rb +++ b/test/ruby/test_m17n.rb @@ -746,7 +746,7 @@ class TestM17N < Test::Unit::TestCase #assert_raise(ArgumentError) { s("%c") % 0xc2a1 } assert_strenc("\u{c2a1}", 'UTF-8', u("%c") % 0xc2a1) assert_strenc("\u{c2}", 'UTF-8', u("%c") % 0xc2) - assert_raise(ArgumentError) { + assert_raise(EncodingCompatibilityError) { "%s%s" % [s("\xc2\xa1"), e("\xc2\xa1")] } end @@ -866,22 +866,22 @@ class TestM17N < Test::Unit::TestCase def test_str_aref_substr assert_equal(a("\xa1\xc2"), a("\xc2\xa1\xc2\xa2\xc2\xa3")[a("\xa1\xc2")]) - assert_raise(ArgumentError) { a("\xc2\xa1\xc2\xa2\xc2\xa3")[e("\xa1\xc2")] } + assert_raise(EncodingCompatibilityError) { a("\xc2\xa1\xc2\xa2\xc2\xa3")[e("\xa1\xc2")] } assert_equal(nil, e("\xc2\xa1\xc2\xa2\xc2\xa3")[e("\xa1\xc2")]) - assert_raise(ArgumentError) { e("\xc2\xa1\xc2\xa2\xc2\xa3")[s("\xa1\xc2")] } + assert_raise(EncodingCompatibilityError) { e("\xc2\xa1\xc2\xa2\xc2\xa3")[s("\xa1\xc2")] } assert_equal(s("\xa1\xc2"), s("\xc2\xa1\xc2\xa2\xc2\xa3")[s("\xa1\xc2")]) - assert_raise(ArgumentError) { s("\xc2\xa1\xc2\xa2\xc2\xa3")[u("\xa1\xc2")] } + assert_raise(EncodingCompatibilityError) { s("\xc2\xa1\xc2\xa2\xc2\xa3")[u("\xa1\xc2")] } assert_equal(nil, u("\xc2\xa1\xc2\xa2\xc2\xa3")[u("\xa1\xc2")]) - assert_raise(ArgumentError) { u("\xc2\xa1\xc2\xa2\xc2\xa3")[a("\xa1\xc2")] } + assert_raise(EncodingCompatibilityError) { u("\xc2\xa1\xc2\xa2\xc2\xa3")[a("\xa1\xc2")] } assert_nil(e("\xa1\xa2\xa3\xa4")[e("\xa2\xa3")]) end def test_aset s = e("\xa3\xb0\xa3\xb1\xa3\xb2\xa3\xb3\xa3\xb4") - assert_raise(ArgumentError){s["\xb0\xa3"] = "foo"} + assert_raise(EncodingCompatibilityError){s["\xb0\xa3"] = "foo"} end def test_str_center @@ -917,13 +917,13 @@ class TestM17N < Test::Unit::TestCase def test_count assert_equal(0, e("\xa1\xa2").count("z")) s = e("\xa3\xb0\xa3\xb1\xa3\xb2\xa3\xb3\xa3\xb4") - assert_raise(ArgumentError){s.count(a("\xa3\xb0"))} + assert_raise(EncodingCompatibilityError){s.count(a("\xa3\xb0"))} end def test_delete assert_equal(1, e("\xa1\xa2").delete("z").length) s = e("\xa3\xb0\xa3\xb1\xa3\xb2\xa3\xb3\xa3\xb4") - assert_raise(ArgumentError){s.delete(a("\xa3\xb2"))} + assert_raise(EncodingCompatibilityError){s.delete(a("\xa3\xb2"))} a = "\u3042\u3044\u3046\u3042\u3044\u3046" a.delete!("\u3042\u3044", "^\u3044") @@ -942,7 +942,7 @@ class TestM17N < Test::Unit::TestCase assert_nil(e("\xa1\xa2\xa3\xa4").index(e("\xa3"))) assert_nil(e("\xa1\xa2\xa3\xa4").rindex(e("\xa3"))) s = e("\xa3\xb0\xa3\xb1\xa3\xb2\xa3\xb3\xa3\xb4") - assert_raise(ArgumentError){s.rindex(a("\xb1\xa3"))} + assert_raise(EncodingCompatibilityError){s.rindex(a("\xb1\xa3"))} end def test_next @@ -985,7 +985,7 @@ class TestM17N < Test::Unit::TestCase def test_upto s1 = e("\xa1\xa2") s2 = s("\xa1\xa2") - assert_raise(ArgumentError){s1.upto(s2) {|x| break }} + assert_raise(EncodingCompatibilityError){s1.upto(s2) {|x| break }} end def test_casecmp @@ -1005,12 +1005,12 @@ class TestM17N < Test::Unit::TestCase end def test_plus - assert_raise(ArgumentError){u("\xe3\x81\x82") + a("\xa1")} + assert_raise(EncodingCompatibilityError){u("\xe3\x81\x82") + a("\xa1")} end def test_chomp s = e("\xa3\xb0\xa3\xb1\xa3\xb2\xa3\xb3\xa3\xb4") - assert_raise(ArgumentError){s.chomp(s("\xa3\xb4"))} + assert_raise(EncodingCompatibilityError){s.chomp(s("\xa3\xb4"))} end def test_gsub @@ -1023,7 +1023,7 @@ class TestM17N < Test::Unit::TestCase t = s.gsub(/b/, "\xa1\xa1".force_encoding("euc-jp")) assert_equal(Encoding::ASCII_8BIT, s.encoding) - assert_raise(ArgumentError) { + assert_raise(EncodingCompatibilityError) { "abc".gsub(/[ac]/) { $& == "a" ? "\xc2\xa1".force_encoding("euc-jp") : "\xc2\xa1".force_encoding("utf-8") @@ -1044,7 +1044,7 @@ class TestM17N < Test::Unit::TestCase def test_each_line s = e("\xa3\xb0\xa3\xb1\xa3\xb2\xa3\xb3\xa3\xb4") - assert_raise(ArgumentError){s.each_line(a("\xa3\xb1")) {|l| }} + assert_raise(EncodingCompatibilityError){s.each_line(a("\xa3\xb1")) {|l| }} s = e("\xa4\xa2\nfoo") actual = [] diff --git a/test/ruby/test_mixed_unicode_escapes.rb b/test/ruby/test_mixed_unicode_escapes.rb index e80e6fb14e..f274ae7090 100644 --- a/test/ruby/test_mixed_unicode_escapes.rb +++ b/test/ruby/test_mixed_unicode_escapes.rb @@ -18,8 +18,8 @@ class TestMixedUnicodeEscape < Test::Unit::TestCase # String interpolation turns into an expression and we get # a different kind of error, but we still can't mix these - assert_raise(ArgumentError) { eval %q("\u{1234}#{nil}")} - assert_raise(ArgumentError) { eval %q("#{nil}\u1234")} + assert_raise(EncodingCompatibilityError) { eval %q("\u{1234}#{nil}")} + assert_raise(EncodingCompatibilityError) { eval %q("#{nil}\u1234")} end end |