diff options
author | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-10-29 16:16:53 +0000 |
---|---|---|
committer | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-10-29 16:16:53 +0000 |
commit | b8aa4fa2f2d0963f30a229f7df3c60a34351978c (patch) | |
tree | 42f74afca892ce398b3ad2f0dffb6cb43d06fbfb | |
parent | 8cb3428cbc3b736cd4ae63a82fc4e2dd39c6f8c8 (diff) | |
download | ruby-b8aa4fa2f2d0963f30a229f7df3c60a34351978c.tar.gz ruby-b8aa4fa2f2d0963f30a229f7df3c60a34351978c.tar.xz ruby-b8aa4fa2f2d0963f30a229f7df3c60a34351978c.zip |
* test/ruby/test_array (test_permutation): add a test that replaces
array during permutation.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@20035 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | test/ruby/test_array.rb | 5 |
2 files changed, 10 insertions, 0 deletions
@@ -1,3 +1,8 @@ +Thu Oct 30 01:10:32 2008 Yusuke Endoh <mame@tsg.ne.jp> + + * test/ruby/test_array (test_permutation): add a test that replaces + array during permutation. + Wed Oct 29 23:57:29 2008 Yusuke Endoh <mame@tsg.ne.jp> * array.c (rb_ary_sort_bang): replacing array during sort broke diff --git a/test/ruby/test_array.rb b/test/ruby/test_array.rb index b8df56110..fcc493951 100644 --- a/test/ruby/test_array.rb +++ b/test/ruby/test_array.rb @@ -1297,6 +1297,11 @@ class TestArray < Test::Unit::TestCase "edcba".each_char.to_a.permutation(5).sort) assert_equal(@cls[].permutation(0).to_a, @cls[[]]) + a = @cls[1, 2, 3, 4] + b = @cls[] + a.permutation {|x| b << x; a.replace(@cls[9, 8, 7, 6]) } + assert_equal(@cls[9, 8, 7, 6], a) + assert_equal(@cls[1, 2, 3, 4].permutation.to_a, b) end def test_take |