We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4a944fc commit 7668bd7Copy full SHA for 7668bd7
spec/ruby/core/struct/hash_spec.rb
@@ -19,6 +19,20 @@
19
car.hash.should == similar_car.hash
20
end
21
22
+ it "returns different hashes for structs with different values" do
23
+ s1 = StructClasses::Ruby.new('2.7.0', 'linux')
24
+ s2 = StructClasses::Ruby.new('2.7.0', 'macos')
25
+ s1.hash.should_not == s2.hash
26
+ end
27
+
28
+ it "returns different hashes for structs with different values when using keyword_init: true" do
29
+ key = :"1 non symbol member"
30
+ struct_class = Struct.new(key, keyword_init: true)
31
+ t1 = struct_class.new(key => 1)
32
+ t2 = struct_class.new(key => 2)
33
+ t1.hash.should_not == t2.hash
34
35
36
it "allows for overriding methods in an included module" do
37
mod = Module.new do
38
def hash
0 commit comments