Sha256: 5f357b376a8a2d09bbb1208da855591926f3a023fa65b6f662708d4ef9faf8eb

Contents?: true

Size: 832 Bytes

Versions: 3

Compression:

Stored size: 832 Bytes

Contents

require 'test/unit'

require 'facet/nil/%5B%5D'
require 'facet/nil/blank%3F'
require 'facet/nil/empty%3F'
require 'facet/nil/include%3F'
require 'facet/nil/length'
require 'facet/nil/to_f'
require 'facet/nil/to_h'


class TC_NilClass < Test::Unit::TestCase

  # brackets-op ( i.e. [] )

  def test_brackets
    assert_equal( nil, nil[] )
    assert_equal( nil, nil[1] )
    assert_equal( nil, nil[1,2,3] )
  end

  # empty?
  
  def test_empty?
    assert( nil.empty? )
  end

  def test_blank?
    assert( nil.blank? )
  end

  # include?
  
  def test_include?
    assert_equal( nil, nil.include? )
  end
  
  # length
  
  def test_length
    assert_equal( 0, nil.length )
  end
  
  
  # to_f
  
  def test_to_f
    assert_equal( 0.0, nil.to_f )
  end

  # to_h
  
  def test_to_h
    assert_equal( {}, nil.to_h )
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
facets-0.7.0 test/nil/tc_nil.rb
facets-0.7.1 test/nil/tc_nil.rb
facets-0.7.2 test/nil/tc_nil.rb