summaryrefslogtreecommitdiff
path: root/test/ruby/test_m17n_comb.rb
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-02-15 07:08:15 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-02-15 07:08:15 +0000
commita8f5a06a68f24ac48363083114c14e9c95ea61ff (patch)
tree0b7844f6215c52d43b361616b47026c2c731ccd9 /test/ruby/test_m17n_comb.rb
parent443b1517cfbee8cf3a0c44f040939edf4f94b9a0 (diff)
* encoding.c (rb_enc_compatible): change the rule for empty strings:
remove the special treatment of the US-ASCII encoded empty string. Now Encoding.compatible? usually respect the encoding of the receiver. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30877 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_m17n_comb.rb')
-rw-r--r--test/ruby/test_m17n_comb.rb14
1 files changed, 5 insertions, 9 deletions
diff --git a/test/ruby/test_m17n_comb.rb b/test/ruby/test_m17n_comb.rb
index 3ecd169c4c..79016afc07 100644
--- a/test/ruby/test_m17n_comb.rb
+++ b/test/ruby/test_m17n_comb.rb
@@ -286,7 +286,7 @@ class TestM17NComb < Test::Unit::TestCase
assert_strenc(a(s), s.encoding, "%s".force_encoding(s.encoding) % s)
if !s.empty? # xxx
t = enccall(a("%s"), :%, s)
- assert_strenc(a(s), s.encoding, t)
+ assert_strenc(a(s), (a('')+s).encoding, t)
end
}
end
@@ -633,13 +633,9 @@ class TestM17NComb < Test::Unit::TestCase
def test_str_casecmp
combination(STRINGS, STRINGS) {|s1, s2|
#puts "#{encdump(s1)}.casecmp(#{encdump(s2)})"
- begin
- r = s1.casecmp(s2)
- rescue ArgumentError
- assert(!s1.valid_encoding? || !s2.valid_encoding?)
- next
- end
- #assert_equal(s1.upcase <=> s2.upcase, r)
+ next unless s1.valid_encoding? && s2.valid_encoding? && Encoding.compatible?(s1, s2)
+ r = s1.casecmp(s2)
+ assert_equal(s1.upcase <=> s2.upcase, r)
}
end
@@ -1031,7 +1027,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 Encoding::CompatibilityError, IndexError => e
+ rescue Encoding::CompatibilityError, IndexError
end
}
end