Skip to content

Commit 207c3c2

Browse files
committed
Add spec for Pointer eql?'ity for #2995.
1 parent a6db2cd commit 207c3c2

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

spec/ffi/pointer_spec.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,15 @@ def to_ptr
138138
expect(FFI::MemoryPointer.new(:int, 1).type_size).to eq(FFI.type_size(:int))
139139
end
140140
end
141+
142+
it "is not eql? for purposes of hash lookup (GH-2995)" do
143+
a = FFI::Pointer.new(0)
144+
b = FFI::Pointer.new(0)
145+
146+
expect(a == b).to eq true
147+
expect(a.eql? b).to eq false
148+
expect(Hash[a,true][b]).to eq nil
149+
end
141150
end
142151

143152
describe "AutoPointer" do

0 commit comments

Comments
 (0)