summaryrefslogtreecommitdiff
path: root/test/ruby/test_m17n_comb.rb
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-12 18:17:05 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-12 18:17:05 +0000
commit85c41f4fbcd58d3515a02d639f6e18b658c09034 (patch)
tree9ab1afc6eee0eadb38e68a4dd6c47c109fb2d1ad /test/ruby/test_m17n_comb.rb
parentfc6484cbf445bfaeb1b68fb48ee5dc72731ac564 (diff)
* error.c (rb_eEncCompatError): add Exception.
* include/ruby/ruby.h: ditto. * encoding.c (rb_enc_check): use rb_eEncCompatError. * string.c (rb_enc_cr_str_buf_cat): ditto. * string.c (rb_str_sub_bang): ditto. * string.c (rb_str_hex): ditto. * string.c (rb_str_oct): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18546 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_m17n_comb.rb')
-rw-r--r--test/ruby/test_m17n_comb.rb74
1 files changed, 37 insertions, 37 deletions
diff --git a/test/ruby/test_m17n_comb.rb b/test/ruby/test_m17n_comb.rb
index 33f67cf0bc..a9ca281367 100644
--- a/test/ruby/test_m17n_comb.rb
+++ b/test/ruby/test_m17n_comb.rb
@@ -261,7 +261,7 @@ class TestM17NComb < Test::Unit::TestCase
def test_str_plus
combination(STRINGS, STRINGS) {|s1, s2|
if s1.encoding != s2.encoding && !s1.ascii_only? && !s2.ascii_only?
- assert_raise(ArgumentError) { s1 + s2 }
+ assert_raise(EncodingCompatibilityError) { s1 + s2 }
else
t = enccall(s1, :+, s2)
assert(t.valid_encoding?) if s1.valid_encoding? && s2.valid_encoding?
@@ -344,7 +344,7 @@ class TestM17NComb < Test::Unit::TestCase
assert_equal(a(s), a(s1) + a(s2))
assert_str_enc_propagation(s, s1, s2)
else
- assert_raise(ArgumentError) { s << s2 }
+ assert_raise(EncodingCompatibilityError) { s << s2 }
end
}
end
@@ -396,7 +396,7 @@ class TestM17NComb < Test::Unit::TestCase
end
end
else
- assert_raise(ArgumentError) { s1[s2] }
+ assert_raise(EncodingCompatibilityError) { s1[s2] }
end
}
end
@@ -481,7 +481,7 @@ class TestM17NComb < Test::Unit::TestCase
end
end
else
- assert_raise(ArgumentError) { t[i] = s2 }
+ assert_raise(EncodingCompatibilityError) { t[i] = s2 }
end
}
}
@@ -513,7 +513,7 @@ class TestM17NComb < Test::Unit::TestCase
end
end
else
- assert_raise(ArgumentError) { t[i,len] = s2 }
+ assert_raise(EncodingCompatibilityError) { t[i,len] = s2 }
end
}
end
@@ -526,7 +526,7 @@ class TestM17NComb < Test::Unit::TestCase
!s2.ascii_only? ? s2.encoding : nil,
!s3.ascii_only? ? s3.encoding : nil].uniq.compact
if 1 < encs.length
- assert_raise(ArgumentError, IndexError) { t[s2] = s3 }
+ assert_raise(EncodingCompatibilityError, IndexError) { t[s2] = s3 }
else
if encs.empty?
encs = [
@@ -565,7 +565,7 @@ class TestM17NComb < Test::Unit::TestCase
end
end
else
- assert_raise(ArgumentError, RangeError,
+ assert_raise(EncodingCompatibilityError, RangeError,
"t=#{encdump(s1)};t[#{first}..#{last}]=#{encdump(s2)}") {
t[first..last] = s2
}
@@ -592,7 +592,7 @@ class TestM17NComb < Test::Unit::TestCase
end
end
else
- assert_raise(ArgumentError, RangeError,
+ assert_raise(EncodingCompatibilityError, RangeError,
"t=#{encdump(s1)};t[#{first}...#{last}]=#{encdump(s2)}") {
t[first...last] = s2
}
@@ -655,7 +655,7 @@ class TestM17NComb < Test::Unit::TestCase
next
end
if !s1.ascii_only? && !s2.ascii_only? && s1.encoding != s2.encoding
- assert_raise(ArgumentError) { s1.center(width, s2) }
+ assert_raise(EncodingCompatibilityError) { s1.center(width, s2) }
next
end
t = enccall(s1, :center, width, s2)
@@ -676,7 +676,7 @@ class TestM17NComb < Test::Unit::TestCase
next
end
if !s1.ascii_only? && !s2.ascii_only? && s1.encoding != s2.encoding
- assert_raise(ArgumentError) { s1.ljust(width, s2) }
+ assert_raise(EncodingCompatibilityError) { s1.ljust(width, s2) }
next
end
t = enccall(s1, :ljust, width, s2)
@@ -697,7 +697,7 @@ class TestM17NComb < Test::Unit::TestCase
next
end
if !s1.ascii_only? && !s2.ascii_only? && s1.encoding != s2.encoding
- assert_raise(ArgumentError) { s1.rjust(width, s2) }
+ assert_raise(EncodingCompatibilityError) { s1.rjust(width, s2) }
next
end
t = enccall(s1, :rjust, width, s2)
@@ -711,7 +711,7 @@ class TestM17NComb < Test::Unit::TestCase
combination(STRINGS, STRINGS) {|s1, s2|
if !s1.ascii_only? && !s2.ascii_only? && !Encoding.compatible?(s1,s2)
if s1.bytesize > s2.bytesize
- assert_raise(ArgumentError) { s1.chomp(s2) }
+ assert_raise(EncodingCompatibilityError) { s1.chomp(s2) }
end
next
end
@@ -777,11 +777,11 @@ class TestM17NComb < Test::Unit::TestCase
def test_str_count
combination(STRINGS, STRINGS) {|s1, s2|
if !s1.valid_encoding? || !s2.valid_encoding?
- assert_raise(ArgumentError) { s1.count(s2) }
+ assert_raise(ArgumentError, EncodingCompatibilityError) { s1.count(s2) }
next
end
if !s1.ascii_only? && !s2.ascii_only? && s1.encoding != s2.encoding
- assert_raise(ArgumentError) { s1.count(s2) }
+ assert_raise(EncodingCompatibilityError) { s1.count(s2) }
next
end
n = enccall(s1, :count, s2)
@@ -809,11 +809,11 @@ class TestM17NComb < Test::Unit::TestCase
next
end
if !s1.valid_encoding? || !s2.valid_encoding?
- assert_raise(ArgumentError) { s1.delete(s2) }
+ assert_raise(ArgumentError, EncodingCompatibilityError) { s1.delete(s2) }
next
end
if !s1.ascii_only? && !s2.ascii_only? && s1.encoding != s2.encoding
- assert_raise(ArgumentError) { s1.delete(s2) }
+ assert_raise(EncodingCompatibilityError) { s1.delete(s2) }
next
end
t = enccall(s1, :delete, s2)
@@ -855,11 +855,11 @@ class TestM17NComb < Test::Unit::TestCase
def test_str_each_line
combination(STRINGS, STRINGS) {|s1, s2|
if !s1.valid_encoding? || !s2.valid_encoding?
- assert_raise(ArgumentError) { s1.each_line(s2) {} }
+ assert_raise(ArgumentError, EncodingCompatibilityError) { s1.each_line(s2) {} }
next
end
if !s1.ascii_only? && !s2.ascii_only? && s1.encoding != s2.encoding
- assert_raise(ArgumentError) { s1.each_line(s2) {} }
+ assert_raise(EncodingCompatibilityError) { s1.each_line(s2) {} }
next
end
lines = []
@@ -908,9 +908,9 @@ class TestM17NComb < Test::Unit::TestCase
def test_str_include?
combination(STRINGS, STRINGS) {|s1, s2|
if !s1.ascii_only? && !s2.ascii_only? && s1.encoding != s2.encoding
- assert_raise(ArgumentError) { s1.include?(s2) }
- assert_raise(ArgumentError) { s1.index(s2) }
- assert_raise(ArgumentError) { s1.rindex(s2) }
+ assert_raise(EncodingCompatibilityError) { s1.include?(s2) }
+ assert_raise(EncodingCompatibilityError) { s1.index(s2) }
+ assert_raise(EncodingCompatibilityError) { s1.rindex(s2) }
next
end
t = enccall(s1, :include?, s2)
@@ -941,7 +941,7 @@ class TestM17NComb < Test::Unit::TestCase
def test_str_index
combination(STRINGS, STRINGS, -2..2) {|s1, s2, pos|
if !s1.ascii_only? && !s2.ascii_only? && s1.encoding != s2.encoding
- assert_raise(ArgumentError) { s1.index(s2) }
+ assert_raise(EncodingCompatibilityError) { s1.index(s2) }
next
end
t = enccall(s1, :index, s2, pos)
@@ -974,7 +974,7 @@ class TestM17NComb < Test::Unit::TestCase
def test_str_rindex
combination(STRINGS, STRINGS, -2..2) {|s1, s2, pos|
if !s1.ascii_only? && !s2.ascii_only? && s1.encoding != s2.encoding
- assert_raise(ArgumentError) { s1.rindex(s2) }
+ assert_raise(EncodingCompatibilityError) { s1.rindex(s2) }
next
end
t = enccall(s1, :rindex, s2, pos)
@@ -1023,11 +1023,11 @@ class TestM17NComb < Test::Unit::TestCase
t2 = s1.dup
begin
t1[nth, 0] = s2
- rescue ArgumentError, IndexError => e1
+ rescue EncodingCompatibilityError, IndexError => e1
end
begin
t2.insert(nth, s2)
- rescue ArgumentError, IndexError => e2
+ rescue EncodingCompatibilityError, IndexError => e2
end
assert_equal(t1, t2, "t=#{encdump s1}; t.insert(#{nth},#{encdump s2}); t")
assert_equal(e1.class, e2.class, "begin #{encdump s1}.insert(#{nth},#{encdump s2}); rescue ArgumentError, IndexError => e; e end")
@@ -1041,7 +1041,7 @@ class TestM17NComb < Test::Unit::TestCase
t1.insert(nth, s2)
slen = s2.length
assert_equal(t1[nth-slen+1,slen], s2, "t=#{encdump s1}; t.insert(#{nth},#{encdump s2}); t")
- rescue ArgumentError, IndexError => e
+ rescue EncodingCompatibilityError, IndexError => e
end
}
end
@@ -1186,11 +1186,11 @@ class TestM17NComb < Test::Unit::TestCase
def test_str_squeeze
combination(STRINGS, STRINGS) {|s1, s2|
if !s1.valid_encoding? || !s2.valid_encoding?
- assert_raise(ArgumentError, "#{encdump s1}.squeeze(#{encdump s2})") { s1.squeeze(s2) }
+ assert_raise(ArgumentError, EncodingCompatibilityError, "#{encdump s1}.squeeze(#{encdump s2})") { s1.squeeze(s2) }
next
end
if !s1.ascii_only? && !s2.ascii_only? && s1.encoding != s2.encoding
- assert_raise(ArgumentError) { s1.squeeze(s2) }
+ assert_raise(EncodingCompatibilityError) { s1.squeeze(s2) }
next
end
t = enccall(s1, :squeeze, s2)
@@ -1280,7 +1280,7 @@ class TestM17NComb < Test::Unit::TestCase
next
end
if !str_enc_compatible?(s1, s2, s3)
- assert_raise(ArgumentError, desc) { s1.tr(s2, s3) }
+ assert_raise(EncodingCompatibilityError, desc) { s1.tr(s2, s3) }
next
end
if !s1.valid_encoding?
@@ -1309,11 +1309,11 @@ class TestM17NComb < Test::Unit::TestCase
next
end
if !s1.valid_encoding?
- assert_raise(ArgumentError, desc) { s1.tr_s(s2, s3) }
+ assert_raise(ArgumentError, EncodingCompatibilityError, desc) { s1.tr_s(s2, s3) }
next
end
if !str_enc_compatible?(s1, s2, s3)
- assert_raise(ArgumentError, desc) { s1.tr(s2, s3) }
+ assert_raise(EncodingCompatibilityError, desc) { s1.tr(s2, s3) }
next
end
if s2.empty?
@@ -1423,7 +1423,7 @@ class TestM17NComb < Test::Unit::TestCase
next
end
if !str_enc_compatible?(s1.gsub(r2, ''), s3)
- assert_raise(ArgumentError, desc) { doit.call }
+ assert_raise(EncodingCompatibilityError, desc) { doit.call }
next
end
t = nil
@@ -1477,7 +1477,7 @@ class TestM17NComb < Test::Unit::TestCase
next
end
if !str_enc_compatible?(s1.gsub(r2, ''), s3)
- assert_raise(ArgumentError, desc) { doit.call }
+ assert_raise(EncodingCompatibilityError, desc) { doit.call }
next
end
t = ret = nil
@@ -1538,7 +1538,7 @@ class TestM17NComb < Test::Unit::TestCase
combination(STRINGS, STRINGS) {|s1, s2|
desc = "#{encdump s1}.end_with?(#{encdump s2})"
if !str_enc_compatible?(s1, s2)
- assert_raise(ArgumentError, desc) { s1.end_with?(s2) }
+ assert_raise(EncodingCompatibilityError, desc) { s1.end_with?(s2) }
next
end
if s1.length < s2.length
@@ -1557,7 +1557,7 @@ class TestM17NComb < Test::Unit::TestCase
combination(STRINGS, STRINGS) {|s1, s2|
desc = "#{encdump s1}.start_with?(#{encdump s2})"
if !str_enc_compatible?(s1, s2)
- assert_raise(ArgumentError, desc) { s1.start_with?(s2) }
+ assert_raise(EncodingCompatibilityError, desc) { s1.start_with?(s2) }
next
end
s1 = s1.dup.force_encoding("ASCII-8BIT")
@@ -1592,7 +1592,7 @@ class TestM17NComb < Test::Unit::TestCase
combination(STRINGS, STRINGS) {|s1, s2|
desc = "#{encdump s1}.partition(#{encdump s2})"
if !str_enc_compatible?(s1, s2)
- assert_raise(ArgumentError, desc) { s1.partition(s2) }
+ assert_raise(EncodingCompatibilityError, desc) { s1.partition(s2) }
next
end
i = enccall(s1, :index, s2)
@@ -1608,7 +1608,7 @@ class TestM17NComb < Test::Unit::TestCase
combination(STRINGS, STRINGS) {|s1, s2|
desc = "#{encdump s1}.rpartition(#{encdump s2})"
if !str_enc_compatible?(s1, s2)
- assert_raise(ArgumentError, desc) { s1.rpartition(s2) }
+ assert_raise(EncodingCompatibilityError, desc) { s1.rpartition(s2) }
next
end
i = enccall(s1, :rindex, s2)