Report abuse


			
  def test_sort_with_replace
    xary = (1..100).to_a
    100.times do
      ary = (1..100).to_a
      ary.sort! {|a,b| ary.replace(xary); a <=> b}
      GC.start
      assert_equal(xary, ary, '[ruby-dev:34732]')
    end
  end


#### In MRI 1.8.6 and JRuby:
test_sort_with_replace(TestArray):
TypeError: can't modify array during iteration