aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_m17n.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.rb
parent443b1517cfbee8cf3a0c44f040939edf4f94b9a0 (diff)
downloadruby-a8f5a06a68f24ac48363083114c14e9c95ea61ff.tar.gz
* 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.rb')
-rw-r--r--test/ruby/test_m17n.rb9
1 files changed, 4 insertions, 5 deletions
diff --git a/test/ruby/test_m17n.rb b/test/ruby/test_m17n.rb
index c8d2d0116c..f6c4a19088 100644
--- a/test/ruby/test_m17n.rb
+++ b/test/ruby/test_m17n.rb
@@ -811,15 +811,15 @@ class TestM17N < Test::Unit::TestCase
end
def test_sprintf_p
- enc = "".inspect.encoding
- asc = Encoding::US_ASCII
Encoding.list.each do |e|
format = "%p".force_encoding(e)
['', 'a', "\xC2\xA1", "\x00"].each do |s|
s.force_encoding(e)
- assert_strenc(s.inspect, e.ascii_compatible? && enc == asc ? e : enc, format % s)
+ enc = (''.force_encoding(e) + s.inspect).encoding
+ assert_strenc(s.inspect, enc, format % s)
end
s = "\xC2\xA1".force_encoding(e)
+ enc = ('' + s.inspect).encoding
assert_strenc('%10s' % s.inspect, enc, "%10p" % s)
end
end
@@ -1086,7 +1086,6 @@ class TestM17N < Test::Unit::TestCase
assert_equal(false, s.ascii_only?, "[ruby-core:14566] reported by Sam Ruby")
s = "abc".force_encoding(Encoding::ASCII_8BIT)
- t = s.gsub(/b/, "\xa1\xa1".force_encoding("euc-jp"))
assert_equal(Encoding::ASCII_8BIT, s.encoding)
assert_raise(Encoding::CompatibilityError) {
@@ -1400,7 +1399,7 @@ class TestM17N < Test::Unit::TestCase
Encoding.list.each do |enc|
next if enc.dummy?
strs = strings.map {|s| s.encode(enc)} rescue next
- yield *strs
+ yield(*strs)
end
end
end