Sha256: 92fc80d0d1b9b4df9e547faeec12ad6d82bb4b1017b344e57ffc6f14ce2fd378
Contents?: true
Size: 1.14 KB
Versions: 4
Compression:
Stored size: 1.14 KB
Contents
require File.expand_path(__FILE__).sub(%r(/test/.*), '/test/test_helper.rb') require File.expand_path(__FILE__).sub(%r(.*/test/), '').sub(/test_(.*)\.rb/,'\1') class TestOptions < Test::Unit::TestCase def test_positions2hash inputs = IndiferentHash.positional2hash([:one, :two, :three], 1, :two => 2, :four => 4) assert_equal 1, inputs[:one] assert_equal 2, inputs[:two] assert_equal nil, inputs[:three] assert_equal nil, inputs[:four] end def test_process_to_hash list = [1,2,3,4] assert_equal 4, IndiferentHash.process_to_hash(list){|l| l.collect{|e| e * 2}}[2] end def test_hash2string hash = {} assert_equal hash, IndiferentHash.string2hash(IndiferentHash.hash2string(hash)) hash = {:a => 1} assert_equal hash, IndiferentHash.string2hash(IndiferentHash.hash2string(hash)) hash = {:a => true} assert_equal hash, IndiferentHash.string2hash(IndiferentHash.hash2string(hash)) hash = {:a => :b} assert_equal hash, IndiferentHash.string2hash(IndiferentHash.hash2string(hash)) hash = {:a => /test/} assert_equal({}, IndiferentHash.string2hash(IndiferentHash.hash2string(hash))) end end
Version data entries
4 entries across 4 versions & 1 rubygems