summaryrefslogtreecommitdiffhomepage
path: root/test/t/hash.rb
diff options
context:
space:
mode:
authorMasaki Muranaka <[email protected]>2013-04-02 11:37:58 +0900
committerMasaki Muranaka <[email protected]>2013-04-02 11:43:30 +0900
commite129a4c8ef5b9bffc696202a73575c8ead187175 (patch)
tree62334a1a44281219d40f478ef929de9bdade2709 /test/t/hash.rb
parent6bd49a3d95c836e82382f333a600a368bf0638fc (diff)
downloadmruby-e129a4c8ef5b9bffc696202a73575c8ead187175.tar.gz
mruby-e129a4c8ef5b9bffc696202a73575c8ead187175.zip
Add test cases.
Diffstat (limited to 'test/t/hash.rb')
-rw-r--r--test/t/hash.rb13
1 files changed, 12 insertions, 1 deletions
diff --git a/test/t/hash.rb b/test/t/hash.rb
index 04a9a1c24..5ba476e40 100644
--- a/test/t/hash.rb
+++ b/test/t/hash.rb
@@ -138,7 +138,18 @@ assert('Hash#include?', '15.2.13.4.15') do
a.include?('abc_key') and not b.include?('cba')
end
-assert('Hash#initialize copy', '15.2.13.4.17') do
+assert('Hash#initialize', '15.2.13.4.16') do
+ # Testing initialize by new.
+ h = Hash.new
+ h2 = Hash.new(:not_found)
+
+ h.is_a? Hash and
+ h == { } and
+ h["hello"] == nil and
+ h2["hello"] == :not_found
+end
+
+assert('Hash#initialize_copy', '15.2.13.4.17') do
a = { 'abc_key' => 'abc_value' }
b = Hash.new.initialize_copy(a)