PageRenderTime 82ms CodeModel.GetById 40ms app.highlight 7ms RepoModel.GetById 33ms app.codeStats 0ms

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

https://bitbucket.org/mediashelf/fedora-migrator
Ruby | 30 lines | 22 code | 7 blank | 1 comment | 1 complexity | 46909d257fe75b8f7312d7f412324b36 MD5 | raw file
 1require 'facets/array/delete'
 2require 'test/unit'
 3
 4class TC_Array_Delete < Test::Unit::TestCase
 5
 6  # delete
 7
 8  def test_delete_unless
 9    a = [1,2,3]
10    a.delete_unless{ |e| e == 2 }
11    assert_equal( [2], a )
12  end
13
14  def test_delete_values
15    a = [1,2,3,4]
16    assert_equal( [1,2], a.delete_values(1,2) )
17    assert_equal( [3,4], a )
18  end
19
20  def test_delete_values_at
21    a = [1,2,3,4]
22    assert_equal( [2,3], a.delete_values_at(1,2) )
23    assert_equal( [1,4], a )
24    a = [1,2,3,4]
25    assert_equal( [1,2,3], a.delete_values_at(0..2) )
26    assert_equal( [4], a )
27  end
28
29end
30