Skip to content

Commit f44f3b3

Browse files
committedOct 29, 2013
Add more Hash specs (initialize, initialize_copy)
1 parent 5dddee5 commit f44f3b3

File tree

4 files changed

+14
-0
lines changed

4 files changed

+14
-0
lines changed
 

‎spec/filters/bugs/hash.rb

+6
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@
8484

8585
fails "Hash#invert compares new keys with eql? semantics"
8686

87+
fails "Hash#initialize_copy does not transfer default values"
88+
fails "Hash#initialize_copy calls to_hash on hash subclasses"
89+
fails "Hash#initialize_copy tries to convert the passed argument to a hash using #to_hash"
90+
fails "Hash#initialize_copy tries to convert the passed argument to a hash using #to_hash"
91+
fails "Hash#initialize_copy replaces the contents of self with other"
92+
8793
fails "Hash#keep_if raises an RuntimeError if called on a frozen instance"
8894

8995
fails "Hash#key? compares keys with the same #hash value via #eql?"

‎spec/filters/unsupported/frozen.rb

+3
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,7 @@
5959
fails "Array#initialize raises a RuntimeError on frozen arrays"
6060

6161
fails "Hash#clear raises a RuntimeError if called on a frozen instance"
62+
fails "Hash#initialize_copy raises a RuntimeError if called on a frozen instance that would not be modified"
63+
fails "Hash#initialize_copy raises a RuntimeError if called on a frozen instance that is modified"
64+
fails "Hash#initialize raises a RuntimeError if called on a frozen instance"
6265
end

‎spec/filters/unsupported/private_methods.rb

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
fails "Array#initialize is private"
33
fails "The defined? keyword when called with a method name having a module as a receiver returns nil if the method is private"
44

5+
fails "Hash#initialize_copy is private"
6+
fails "Hash#initialize is private"
7+
58
fails "Defining an 'initialize' method sets the method's visibility to private"
69
fails "Defining an 'initialize_copy' method sets the method's visibility to private"
710

‎spec/rubyspecs

+2
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,8 @@ core/hash/include_spec
174174
core/hash/index_spec
175175
core/hash/indexes_spec
176176
core/hash/indices_spec
177+
core/hash/initialize_copy_spec
178+
core/hash/initialize_spec
177179
core/hash/invert_spec
178180
core/hash/keep_if_spec
179181
core/hash/key_spec

0 commit comments

Comments
 (0)
Please sign in to comment.