Sha256: 6f869fc894be1962c9b3bbe2649534642dc0fbabe01f6daf82a0224978b82154

Contents?: true

Size: 774 Bytes

Versions: 1

Compression:

Stored size: 774 Bytes

Contents

require 'test/unit'

require 'facet/nil/[]'
require 'facet/nil/empty?'
require 'facet/nil/include?'
require 'facet/nil/length'
require 'facet/nil/to_f'
require 'facet/nil/to_h'


class TC_NilClass < Test::Unit::TestCase

  # []

  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

1 entries across 1 versions & 1 rubygems

Version Path
facets-0.6.3 test/nil/tc_nil.rb