summaryrefslogtreecommitdiff
path: root/test/ruby/test_string.rb
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-02-17 10:15:28 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-02-17 10:15:28 +0000
commitd092fc539831062af3b87d2f4e29e94da3cc9b0e (patch)
tree9cd8993f4d68151514f9f7dea5c23ec1947ed638 /test/ruby/test_string.rb
parentc00d51c739003285255c1a285d121761de310572 (diff)
Additional fix and tests for r53851
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53854 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_string.rb')
-rw-r--r--test/ruby/test_string.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb
index 339e8728ab..c78ecc1d6c 100644
--- a/test/ruby/test_string.rb
+++ b/test/ruby/test_string.rb
@@ -59,6 +59,17 @@ class TestString < Test::Unit::TestCase
assert_equal(Encoding::EUC_JP, S("", capacity: 1000, encoding: "euc-jp").encoding)
end
+ def test_initialize
+ str = S("").freeze
+ assert_equal("", str.__send__(:initialize))
+ assert_raise(RuntimeError){ str.__send__(:initialize, 'abc') }
+ assert_raise(RuntimeError){ str.__send__(:initialize, capacity: 1000) }
+ assert_raise(RuntimeError){ str.__send__(:initialize, 'abc', capacity: 1000) }
+ assert_raise(RuntimeError){ str.__send__(:initialize, encoding: 'euc-jp') }
+ assert_raise(RuntimeError){ str.__send__(:initialize, 'abc', encoding: 'euc-jp') }
+ assert_raise(RuntimeError){ str.__send__(:initialize, 'abc', capacity: 1000, encoding: 'euc-jp') }
+ end
+
def test_AREF # '[]'
assert_equal("A", S("AooBar")[0])
assert_equal("B", S("FooBaB")[-1])