From b8aa4fa2f2d0963f30a229f7df3c60a34351978c Mon Sep 17 00:00:00 2001 From: mame Date: Wed, 29 Oct 2008 16:16:53 +0000 Subject: * 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 --- test/ruby/test_array.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'test/ruby/test_array.rb') 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 -- cgit