/vendor/gems/facets-2.4.5/test/more/test_partial.rb

https://bitbucket.org/mediashelf/fedora-migrator · Ruby · 27 lines · 19 code · 7 blank · 1 comment · 0 complexity · 417381864faf9d9a2e90298b699165eb MD5 · raw file

  1. # Test lib/more/ext/facets/proc/partial.rb
  2. require 'facets/partial.rb'
  3. require 'test/unit'
  4. class TestProcPartial < Test::Unit::TestCase
  5. def test_first
  6. f = Proc.new{ |a,b,c| a + b + c }
  7. n = f.partial(__,2,3)
  8. assert_equal( 6, n[1] )
  9. end
  10. def test_second
  11. f = Proc.new{ |a,b,c| a + b + c }
  12. n = f.partial(1,__,3)
  13. assert_equal( 6, n[2] )
  14. end
  15. def test_third
  16. f = Proc.new{ |a,b,c| a + b + c }
  17. n = f.partial(1,2,__)
  18. assert_equal( 6, n[3] )
  19. end
  20. end