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

https://bitbucket.org/mediashelf/fedora-migrator · Ruby · 21 lines · 10 code · 5 blank · 6 comment · 0 complexity · e7eb4f0b5cbdafcda6df322e4f3451e6 MD5 · raw file

  1. # _____ _
  2. # |_ _|__ ___| |_
  3. # | |/ _ \/ __| __|
  4. # | | __/\__ \ |
  5. # |_|\___||___/\__|
  6. #
  7. require 'facets/array/only.rb'
  8. require 'test/unit'
  9. class TestArrayOnly < Test::Unit::TestCase
  10. def test_only
  11. assert_equal(5, [5].only)
  12. assert_equal(nil, [nil].only)
  13. assert_raise(IndexError) { [].only }
  14. assert_raise(IndexError) { [1,2,3].only }
  15. end
  16. end