1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Use an isolated class

The number of all instances of `Class` may be affected by GC-able
anonymous classes created by other tests.
This commit is contained in:
Nobuyoshi Nakada 2021-10-10 01:20:40 +09:00
parent 5805b1472a
commit 7f3786c3e8
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6

View file

@ -13,9 +13,10 @@ describe "ObjectSpace.memsize_of_all" do
end end
it "increases when a new object is allocated" do it "increases when a new object is allocated" do
before = ObjectSpace.memsize_of_all(Class) c = Class.new
o = Class.new before = ObjectSpace.memsize_of_all(c)
after = ObjectSpace.memsize_of_all(Class) o = c.new
after = ObjectSpace.memsize_of_all(c)
after.should > before after.should > before
end end
end end