summaryrefslogtreecommitdiff
path: root/spec/ruby/core/objectspace/weakmap/shared/size.rb
blob: 1064f99d1b987ba175512b740a61067270958231 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
describe :weakmap_size, shared: true do
  it "is correct" do
    map = ObjectSpace::WeakMap.new
    key1, key2 = %w[a b].map(&:upcase)
    ref1, ref2 = %w[x y]
    map.send(@method).should == 0
    map[key1] = ref1
    map.send(@method).should == 1
    map[key1] = ref1
    map.send(@method).should == 1
    map[key2] = ref2
    map.send(@method).should == 2
  end
end