require 'test/unit' require 'methodic_hash' class TC_MethodicHash < Test::Unit::TestCase def test_accesses mh = MethodicHash.new assert((mh['one'] = 1) == 1) assert(mh['one'] == 1) assert(mh[:one] == 1) assert(mh.one == 1) assert((mh[:two] = 2) == 2) assert(mh['two'] == 2) assert(mh[:two] == 2) assert(mh.two == 2) assert(mh['three'] == nil) assert(mh[:three] == nil) assert(mh.three == nil) assert((mh.four = 4) == 4) assert(mh['four'] == 4) assert(mh[:four] == 4) assert(mh.four == 4) assert(mh[1.25] == nil) end end