summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-02-17 00:18:16 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-02-17 00:18:16 +0000
commit35cb0f807b4689b0405dfbb2821e13f14c1fca45 (patch)
tree70c0d395007ea24074b188c0b84203f725501100 /test
parent71c5e485989cfead51f62f36d0d694cab65f855f (diff)
* string.c (rb_str_times): reduce loop overhead.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15514 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_string.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb
index b684ca8bd1..711d9ea1f9 100644
--- a/test/ruby/test_string.rb
+++ b/test/ruby/test_string.rb
@@ -174,7 +174,7 @@ class TestString < Test::Unit::TestCase
s = "a"
10.times {|i|
s << s
- assert_equal("a" * (2<<i), s)
+ assert_equal("a" * (2 << i), s)
}
end
@@ -1370,4 +1370,13 @@ class TestString < Test::Unit::TestCase
def test_end_with?
assert("abc".end_with?("c"))
end
+
+ def test_times
+ s1 = ''
+ 100.times {|n|
+ s2 = "a" * n
+ assert_equal(s1, s2)
+ s1 << 'a'
+ }
+ end
end