Sha256: 9aa4cb45aaf47bdd03aab1a04d44d0a9f1cad8301c489bfc532f946e6e812383

Contents?: true

Size: 872 Bytes

Versions: 9

Compression:

Stored size: 872 Bytes

Contents

# encoding: utf-8

require 'helper'

class ArrayExtTest < Test::Unit::TestCase
  def test_extract_options
    array = [ 1, 2, 3 ]
    options = array.extract_options!
    assert_equal({}, options)
    assert_equal([1,2,3], array)

    array = [ ]
    options = array.extract_options!
    assert_equal({}, options)
    assert_equal([], array)

    array = [ 1, 2, 3, {} ]
    options = array.extract_options!
    assert_equal({}, options)
    assert_equal([1,2,3], array)

    array = [ {} ]
    options = array.extract_options!
    assert_equal({}, options)
    assert_equal([], array)

    array = [ 1, 2, 3, { 1 => 2 } ]
    options = array.extract_options!
    assert_equal({ 1 => 2 }, options)
    assert_equal([1,2,3], array)

    array = [ { 1 => 2 } ]
    options = array.extract_options!
    assert_equal({ 1 => 2 }, options)
    assert_equal([], array)
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
radiospieler-0.3.0 test/array_ext_test.rb
radiospiel-app-0.2.10 test/array_ext_test.rb
radiospiel-app-0.2.9 test/array_ext_test.rb
radiospiel-app-0.2.7 test/array_ext_test.rb
radiospiel-app-0.2.6 test/array_ext_test.rb
radiospiel-app-0.2.5 test/array_ext_test.rb
radiospiel-app-0.2.3 test/array_ext_test.rb
radiospiel-app-0.2.2 test/array_ext_test.rb
radiospiel-app-0.2.1 test/array_ext_test.rb