fedora-migrator /vendor/gems/facets-2.4.5/test/core/array/test_delete.rb

Language Ruby Lines 31
MD5 Hash 46909d257fe75b8f7312d7f412324b36 Estimated Cost $491 (why?)
Repository https://bitbucket.org/mediashelf/fedora-migrator View Raw File
 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
require 'facets/array/delete'
require 'test/unit'

class TC_Array_Delete < Test::Unit::TestCase

  # delete

  def test_delete_unless
    a = [1,2,3]
    a.delete_unless{ |e| e == 2 }
    assert_equal( [2], a )
  end

  def test_delete_values
    a = [1,2,3,4]
    assert_equal( [1,2], a.delete_values(1,2) )
    assert_equal( [3,4], a )
  end

  def test_delete_values_at
    a = [1,2,3,4]
    assert_equal( [2,3], a.delete_values_at(1,2) )
    assert_equal( [1,4], a )
    a = [1,2,3,4]
    assert_equal( [1,2,3], a.delete_values_at(0..2) )
    assert_equal( [4], a )
  end

end
Back to Top