summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-10-29 16:16:53 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-10-29 16:16:53 +0000
commit97bba2ed7b0e2572276076773905f385af87a71e (patch)
tree3942f1ae8de68aedee9b1a44f5b4da672fe761ca /test
parent0e5e1a11e831f785a649457a5e8dbe8b3bac25c2 (diff)
downloadruby-97bba2ed7b0e2572276076773905f385af87a71e.tar.gz
ruby-97bba2ed7b0e2572276076773905f385af87a71e.tar.xz
ruby-97bba2ed7b0e2572276076773905f385af87a71e.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/branches/ruby_1_9_1@20035 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_array.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/ruby/test_array.rb b/test/ruby/test_array.rb
index cfb36045e..f3ee624bf 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