* string.c (rb_str_upto): keep first width. [ruby-dev:39361]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25050 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2009-09-23 04:14:23 +00:00
parent 5a993c5d22
commit 1b541acd69
4 changed files with 28 additions and 4 deletions

View file

@ -1577,6 +1577,19 @@ class TestString < Test::Unit::TestCase
assert_equal(676, count)
end
def test_upto_numeric
a = S("00")
start = S("00")
count = 0
assert_equal(S("00"), a.upto(S("23")) {|s|
assert_equal(start, s, "[ruby-dev:39361]")
assert_equal(Encoding::US_ASCII, s.encoding)
start.succ!
count += 1
})
assert_equal(24, count, "[ruby-dev:39361]")
end
def test_mod_check
assert_raise(RuntimeError) {
s = ""