diff options
author | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-10-29 16:46:08 +0000 |
---|---|---|
committer | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-10-29 16:46:08 +0000 |
commit | 143f059bcd84284b54445d237ad202f1cb3e639a (patch) | |
tree | e710022b1aa201f474c25cee2c88226b494a2083 | |
parent | f27e4c045f752e09176a3c4ef0dd4ba20266fa29 (diff) | |
download | ruby-143f059bcd84284b54445d237ad202f1cb3e639a.tar.gz |
* test/ruby/test_array.rb: add some tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20047 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | test/ruby/test_array.rb | 29 |
2 files changed, 34 insertions, 1 deletions
@@ -1,3 +1,7 @@ +Thu Oct 30 01:44:23 2008 Yusuke Endoh <mame@tsg.ne.jp> + + * test/ruby/test_array.rb: add some tests. + Thu Oct 30 01:32:15 2008 Yusuke Endoh <mame@tsg.ne.jp> * array.c (rb_ary_splice): remove redundant check. @@ -9,7 +13,7 @@ Thu Oct 30 01:24:55 2008 Yusuke Endoh <mame@tsg.ne.jp> Thu Oct 30 01:10:32 2008 Yusuke Endoh <mame@tsg.ne.jp> - * test/ruby/test_array (test_permutation): add a test that replaces + * test/ruby/test_array.rb (test_permutation): add a test that replaces array during permutation. Wed Oct 29 23:31:34 2008 Yukihiro Matsumoto <matz@ruby-lang.org> diff --git a/test/ruby/test_array.rb b/test/ruby/test_array.rb index fcc493951f..862385236e 100644 --- a/test/ruby/test_array.rb +++ b/test/ruby/test_array.rb @@ -1624,4 +1624,33 @@ class TestArray < Test::Unit::TestCase assert_equal(true, s.tainted?) assert_equal(true, s.untrusted?) end + + def test_initialize2 + a = [1] * 1000 + a.instance_eval { initialize } + assert_equal([], a) + end + + def test_shift_shared_ary + a = (1..100).to_a + b = [] + b.replace(a) + assert_equal((1..10).to_a, a.shift(10)) + assert_equal((11..100).to_a, a) + end + + def test_replace_shared_ary + a = [1] * 100 + b = [] + b.replace(a) + a.replace([1, 2, 3]) + assert_equal([1, 2, 3], a) + assert_equal([1] * 100, b) + end + + def test_fill_negative_length + a = (1..10).to_a + a.fill(:foo, 5, -3) + assert_equal((1..10).to_a, a) + end end |