test/struct_info_test.rb in must-0.2.5 vs test/struct_info_test.rb in must-0.2.6
- old
+ new
@@ -27,11 +27,13 @@
######################################################################
### struct
def test_compact
assert_equal(Fixnum, Must::StructInfo.new(1).compact)
- assert_equal({}, Must::StructInfo.new({}).compact)
+ assert_equal(Hash, Must::StructInfo.new({}).compact)
+ assert_equal(Array, Must::StructInfo.new([]).compact)
+ assert_equal([Fixnum], Must::StructInfo.new([1]).compact)
assert_equal({String=>Fixnum}, Must::StructInfo.new({"a"=>1}).compact)
assert_equal([{String=>Float}], Must::StructInfo.new([{"1"=>0.25}]).compact)
assert_equal({String=>{String=>[{Symbol=>Fixnum}]}}, Must::StructInfo.new({"1.1" => {"jp"=>[{:a=>0},{:b=>2}]}}).compact)
end
@@ -43,10 +45,12 @@
######################################################################
### pp
def test_inspect
assert_equal "Fixnum", Must::StructInfo.new(1).inspect
- assert_equal "{}", Must::StructInfo.new({}).inspect
+ assert_equal "Hash", Must::StructInfo.new({}).inspect
+ assert_equal "Array", Must::StructInfo.new([]).inspect
+ assert_equal "[Fixnum]", Must::StructInfo.new([1]).inspect
assert_equal "{String=>Fixnum}", Must::StructInfo.new({"a"=>1}).inspect
assert_equal "[{String=>Float}]", Must::StructInfo.new([{"1"=>0.25}]).inspect
assert_equal "{String=>{String=>[{Symbol=>Fixnum}]}}", Must::StructInfo.new({"1.1" => {"jp"=>[{:a=>0},{:b=>2}]}}).inspect
end
end