summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-03-30 05:15:51 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-03-30 05:15:51 +0000
commit3e89498bea13a6fedd0b485ea93387b935b795a8 (patch)
tree7641b0fe61141ce48997e0d7e489302124755408 /test
parentd66248a7cd7290366d0a6e88763f20901ec22796 (diff)
merge revision(s) 35146:
* string.c (str_new_empty): should copy also the encoding as an empty substring. [ruby-dev:45441][Bug #6206] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@35178 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_string.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb
index faa7bd670d..4d9d172ccf 100644
--- a/test/ruby/test_string.rb
+++ b/test/ruby/test_string.rb
@@ -1164,6 +1164,12 @@ class TestString < Test::Unit::TestCase
assert_equal("[2, 3]", [1,2,3].slice!(1,10000).inspect, "moved from btest/knownbug")
+ bug6206 = '[ruby-dev:45441]'
+ Encoding.list.each do |enc|
+ next unless enc.ascii_compatible?
+ s = S("a:".force_encoding(enc))
+ assert_equal([enc]*2, s.split(":", 2).map(&:encoding), bug6206)
+ end
end
def test_squeeze
@@ -1803,6 +1809,13 @@ class TestString < Test::Unit::TestCase
assert_raise(TypeError) { "hello".partition(1) }
def (hyphen = Object.new).to_str; "-"; end
assert_equal(%w(foo - bar), "foo-bar".partition(hyphen), '[ruby-core:23540]')
+
+ bug6206 = '[ruby-dev:45441]'
+ Encoding.list.each do |enc|
+ next unless enc.ascii_compatible?
+ s = S("a:".force_encoding(enc))
+ assert_equal([enc]*3, s.partition("|").map(&:encoding), bug6206)
+ end
end
def test_rpartition
@@ -1811,6 +1824,13 @@ class TestString < Test::Unit::TestCase
assert_raise(TypeError) { "hello".rpartition(1) }
def (hyphen = Object.new).to_str; "-"; end
assert_equal(%w(foo - bar), "foo-bar".rpartition(hyphen), '[ruby-core:23540]')
+
+ bug6206 = '[ruby-dev:45441]'
+ Encoding.list.each do |enc|
+ next unless enc.ascii_compatible?
+ s = S("a:".force_encoding(enc))
+ assert_equal([enc]*3, s.rpartition("|").map(&:encoding), bug6206)
+ end
end
def test_setter