Sha256: 811199be2c7f8bd54632f59b93beea2b77125081e9839e949c6d9fc94e901c8c

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

Stored size: 1.02 KB

Contents

require 'helper'

class TestCoreExtensions < FunWith::Files::TestCase
  context "testing hash" do
    should "fwf_reverse_merge nicely" do
      h = { "1" => 1, "2" => 2 }.fwf_reverse_merge( "3" => 3, "1" => 0 )
      
      assert_equal 1, h["1"]
      assert_equal 2, h["2"]
      assert_equal 3, h["3"]
      
      h.fwf_reverse_merge!( "1" => "one", "2" => "two", "3" => "three" )
      
      assert_equal 1, h["1"]
      assert_equal 2, h["2"]
      assert_equal 3, h["3"]
      
      h.fwf_reverse_merge!( "1" => "one", "2" => "two", "3" => "three", "4" => "four" )

      assert_equal 1, h["1"]
      assert_equal 2, h["2"]
      assert_equal 3, h["3"]
      assert_equal "four", h["4"]
    end
    
    should "fwf_blank? nicely." do
      assert_equal false, { 1 => 2 }.fwf_blank?
      assert_equal true, {}.fwf_blank?
      assert_equal true, true.fwf_present?
    end
    
    should "respond to fwf_filepath" do
      assert_respond_to ".", :fwf_filepath
      assert_respond_to ".".fwf_filepath, :fwf_filepath
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fun_with_files-0.0.18 ./test/test_core_extensions.rb