summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-18 13:17:41 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-18 13:17:41 +0000
commitc3e2e0e53f0e5bfd1277152fa7705c22a44bf573 (patch)
tree423d782590bb97c6cc739a8d277acdc26a31e464 /test
parent081c802cb9fe84d349bc4ecf26a36eceae431aed (diff)
* string.c (rb_str_comparable): make ascii8bit string to be
compatible with any other encoding. * string.c (rb_str_cmp): use rb_str_comparable() instead of rb_enc_compatible() since <=> is a comparison anyway. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_m17n_comb.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/test/ruby/test_m17n_comb.rb b/test/ruby/test_m17n_comb.rb
index 9de64f49122..50fe8c2233d 100644
--- a/test/ruby/test_m17n_comb.rb
+++ b/test/ruby/test_m17n_comb.rb
@@ -318,10 +318,11 @@ class TestM17NComb < Test::Unit::TestCase
def test_str_eq
combination(STRINGS, STRINGS) {|s1, s2|
desc_eq = "#{encdump s1} == #{encdump s2}"
- if s1.ascii_only? && s2.ascii_only? && a(s1) == a(s2)
- assert(s1 == s2, desc_eq)
- assert(s1.eql?(s2), desc_eq)
- elsif s1.encoding == s2.encoding && a(s1) == a(s2)
+ if a(s1) == a(s2) and
+ (s1.ascii_only? && s2.ascii_only? or
+ s1.encoding == s2.encoding or
+ s1.encoding == (enc = Encoding.find("ASCII-8BIT")) or
+ s2.encoding == enc) then
assert(s1 == s2, desc_eq)
assert(!(s1 != s2))
assert_equal(0, s1 <=> s2)