1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
This commit is contained in:
Benoit Daloze 2020-01-28 20:47:48 +01:00
parent ed377cc9aa
commit 809f0b8a13
76 changed files with 2451 additions and 224 deletions

View file

@ -19,6 +19,22 @@ describe "Struct#hash" do
car.hash.should == similar_car.hash
end
it "returns different hashes for structs with different values" do
s1 = StructClasses::Ruby.new('2.7.0', 'linux')
s2 = StructClasses::Ruby.new('2.7.0', 'macos')
s1.hash.should_not == s2.hash
end
ruby_version_is "2.5" do
it "returns different hashes for structs with different values when using keyword_init: true" do
key = :"1 non symbol member"
struct_class = Struct.new(key, keyword_init: true)
t1 = struct_class.new(key => 1)
t2 = struct_class.new(key => 2)
t1.hash.should_not == t2.hash
end
end
it "allows for overriding methods in an included module" do
mod = Module.new do
def hash