summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-01-25 00:39:26 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-01-25 00:39:26 +0000
commit390f087d871446b130ae3666620ccabb2e4e2ff8 (patch)
tree6e7a3606452d817d6c007591c9d6a6244977143d /test/ruby
parent65793c9c179846266345a3581877fcd3a9869729 (diff)
* test/ruby/test_string.rb: added testcase for next!, succ and succ!
[fix GH-1213] Patch by @K0mAtoru git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53649 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_string.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb
index 7eed784..f1633e3 100644
--- a/test/ruby/test_string.rb
+++ b/test/ruby/test_string.rb
@@ -995,6 +995,9 @@ class TestString < Test::Unit::TestCase
assert_equal(S("AAAAA000"), S("ZZZZ999").next)
assert_equal(S("*+"), S("**").next)
+
+ assert_equal(S("!"), S(" ").next)
+ assert_equal(S(""), S("").next)
end
def test_next!
@@ -1031,6 +1034,10 @@ class TestString < Test::Unit::TestCase
a = S("**")
assert_equal(S("*+"), a.next!)
assert_equal(S("*+"), a)
+
+ a = S(" ")
+ assert_equal(S("!"), a.next!)
+ assert_equal(S("!"), a)
end
def test_oct
@@ -1541,6 +1548,9 @@ class TestString < Test::Unit::TestCase
assert_equal("2000aaa", "1999zzz".succ)
assert_equal("AAAA0000", "ZZZ9999".succ)
assert_equal("**+", "***".succ)
+
+ assert_equal("!", " ".succ)
+ assert_equal("", "".succ)
end
def test_succ!
@@ -1582,6 +1592,14 @@ class TestString < Test::Unit::TestCase
assert_equal(S("No.10"), a.succ!)
assert_equal(S("No.10"), a)
+ a = S(" ")
+ assert_equal(S("!"), a.succ!)
+ assert_equal(S("!"), a)
+
+ a = S("")
+ assert_equal(S(""), a.succ!)
+ assert_equal(S(""), a)
+
assert_equal("aaaaaaaaaaaa", "zzzzzzzzzzz".succ!)
assert_equal("aaaaaaaaaaaaaaaaaaaaaaaa", "zzzzzzzzzzzzzzzzzzzzzzz".succ!)
end