fork download
  1. def test_slicing_arrays
  2. array = [:peanut, :butter, :and, :jelly]
  3.  
  4. assert_equal [:peanut], array[0,1]
  5. assert_equal [:peanut, :butter], array[0,2]
  6. assert_equal [:and, :jelly], array[2,2]
  7. assert_equal [:and, :jelly], array[2,20]
  8. assert_equal [], array[4,0]
  9. assert_equal [], array[4,100]
  10. assert_equal nil, array[5,0]
  11. end
Success #stdin #stdout 0.05s 9608KB
stdin
Standard input is empty
stdout
Standard output is empty