/vendor/gems/facets-2.4.5/test/core/array/test_only.rb
Ruby | 21 lines | 10 code | 5 blank | 6 comment | 0 complexity | e7eb4f0b5cbdafcda6df322e4f3451e6 MD5 | raw file
Possible License(s): GPL-3.0, GPL-2.0, IPL-1.0, AGPL-1.0, LGPL-3.0
- # _____ _
- # |_ _|__ ___| |_
- # | |/ _ \/ __| __|
- # | | __/\__ \ |
- # |_|\___||___/\__|
- #
- require 'facets/array/only.rb'
- require 'test/unit'
- class TestArrayOnly < Test::Unit::TestCase
- def test_only
- assert_equal(5, [5].only)
- assert_equal(nil, [nil].only)
- assert_raise(IndexError) { [].only }
- assert_raise(IndexError) { [1,2,3].only }
- end
- end