Permalink
Browse files

Add more test cases for test coverage.

  • Loading branch information...
1 parent 82c891a commit 71cc4e13bfdac5c5975b3785558324944bb50bd3 @monaka monaka committed May 8, 2013
Showing with 13 additions and 2 deletions.
  1. +13 −2 test/t/hash.rb
View
15 test/t/hash.rb
@@ -52,9 +52,12 @@
assert('Hash#default_proc', '15.2.13.4.7') do
a = Hash.new
- b = Hash.new {|s,k| s[k] = k}
+ b = Hash.new {|s,k| s[k] = k + k}
+ c = b[2]
+ d = b['cat']
- a.default_proc == nil and b.default_proc.class == Proc
+ a.default_proc == nil and b.default_proc.class == Proc and
+ c = 4 and d = 'catcat'
end
assert('Hash#delete', '15.2.13.4.8') do
@@ -278,3 +281,11 @@
h == {:two => 2, :four => 4}
end
+# Not ISO specified
+
+assert('Hash#inspect') do
+ h = { "c" => 300, "a" => 100, "d" => 400, "c" => 300 }
+ ret = h.to_s
+
+ ret = "{\"c\"=>300, \"a\"=>100, \"d\"=>400}"
+end

0 comments on commit 71cc4e1

Please sign in to comment.