[前][次][番号順一覧][スレッド一覧]

ruby-changes:8513

From: mame <ko1@a...>
Date: Thu, 30 Oct 2008 01:46:32 +0900 (JST)
Subject: [ruby-changes:8513] Ruby:r20047 (ruby_1_9_1, trunk): * test/ruby/test_array.rb: add some tests.

mame	2008-10-30 01:46:08 +0900 (Thu, 30 Oct 2008)

  New Revision: 20047

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=20047

  Log:
    * test/ruby/test_array.rb: add some tests.

  Modified files:
    branches/ruby_1_9_1/ChangeLog
    branches/ruby_1_9_1/test/ruby/test_array.rb
    trunk/ChangeLog
    trunk/test/ruby/test_array.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 20046)
+++ ChangeLog	(revision 20047)
@@ -1,3 +1,7 @@
+Thu Oct 30 01:44:23 2008  Yusuke Endoh  <mame@t...>
+
+	* test/ruby/test_array.rb: add some tests.
+
 Thu Oct 30 01:32:15 2008  Yusuke Endoh  <mame@t...>
 
 	* array.c (rb_ary_splice): remove redundant check.
@@ -9,7 +13,7 @@
 
 Thu Oct 30 01:10:32 2008  Yusuke Endoh  <mame@t...>
 
-	* 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@r...>
Index: test/ruby/test_array.rb
===================================================================
--- test/ruby/test_array.rb	(revision 20046)
+++ test/ruby/test_array.rb	(revision 20047)
@@ -1624,4 +1624,33 @@
     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
Index: ruby_1_9_1/ChangeLog
===================================================================
--- ruby_1_9_1/ChangeLog	(revision 20046)
+++ ruby_1_9_1/ChangeLog	(revision 20047)
@@ -1,3 +1,7 @@
+Thu Oct 30 01:44:23 2008  Yusuke Endoh  <mame@t...>
+
+	* test/ruby/test_array.rb: add some tests.
+
 Thu Oct 30 01:32:15 2008  Yusuke Endoh  <mame@t...>
 
 	* array.c (rb_ary_splice): remove redundant check.
@@ -9,7 +13,7 @@
 
 Thu Oct 30 01:10:32 2008  Yusuke Endoh  <mame@t...>
 
-	* 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:57:29 2008  Yusuke Endoh  <mame@t...>
Index: ruby_1_9_1/test/ruby/test_array.rb
===================================================================
--- ruby_1_9_1/test/ruby/test_array.rb	(revision 20046)
+++ ruby_1_9_1/test/ruby/test_array.rb	(revision 20047)
@@ -1624,4 +1624,33 @@
     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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]