Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

file 46 lines (38 sloc) 1.111 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
require 'test_helper'

class ArrayTest < EdgeCase::TestCase

  def test_basic_arrays
    food = [:peanut, :button, :and, :jelly]
    assert_equal __, food[0]
    assert_equal __, food.size
  end

  def test_array_access
    food = [:peanut, :button, :and, :jelly]
    assert_equal __, food.first
    assert_equal __, food.last
    assert_equal __, food[0]
    assert_equal __, food[2]
    assert_equal __, food[(food.size() - 1)]
  end

  def test_arrays_with_other_objects
    food = [:peanut, :button, :and, :jelly, 1, nil]
    assert_equal __, food.size
    assert_equal __, food.last
    assert_equal __, food[5]
  end

  def test_adding_to_an_array_with_shovel_shovel
    food = [:peanut, :button, :and, :jelly]
    food << 'sandwich'
    assert_equal __, food.size
    assert_equal __, food.first
  end

  def test_adding_to_an_array_with_push
    food = [:peanut, :button, :and, :jelly]
    food.push('sandwich')
    assert_equal __, food.last
  end

  def test_adding_to_an_array_with_unshift
    food = [:peanut, :button, :and, :jelly]
    food.unshift('a')
    assert_equal __, food.first
  end

end
Something went wrong with that request. Please try again.