aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_m17n.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-01-04 05:24:39 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-01-04 05:24:39 +0000
commit460528289ab3b22f373c00a8494f65e5c3dcfdde (patch)
tree05892a275bee3df41e2645da9f3c1fc7d6f04118 /test/ruby/test_m17n.rb
parent79e0379a7573e998d52ea42242ea0cc96fa81738 (diff)
downloadruby-460528289ab3b22f373c00a8494f65e5c3dcfdde.tar.gz
* string.c (str_nth_len): count ascii-only run at the end. this
bug appears only when single-byte-optimization is disabled due to unknown coderange. [ruby-core:41896] [Bug #5836] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34208 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_m17n.rb')
-rw-r--r--test/ruby/test_m17n.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ruby/test_m17n.rb b/test/ruby/test_m17n.rb
index f4d3dcbdad..cc42514da2 100644
--- a/test/ruby/test_m17n.rb
+++ b/test/ruby/test_m17n.rb
@@ -930,6 +930,15 @@ class TestM17N < Test::Unit::TestCase
assert_equal("\u{439}", "a\u{439}bcdefghijklmnop"[1, 1][0, 1], bug2379)
end
+ def test_str_aref_force_encoding
+ bug5836 = '[ruby-core:41896]'
+ Encoding.list.each do |enc|
+ next unless enc.ascii_compatible?
+ s = "abc".force_encoding(enc)
+ assert_equal("", s[3, 1], bug5836)
+ end
+ end
+
def test_aset
s = e("\xa3\xb0\xa3\xb1\xa3\xb2\xa3\xb3\xa3\xb4")
assert_raise(Encoding::CompatibilityError){s["\xb0\xa3"] = "foo"}