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:
parent
5805b1472a
commit
7f3786c3e8
1 changed files with 4 additions and 3 deletions
|
@ -13,9 +13,10 @@ describe "ObjectSpace.memsize_of_all" do
|
|||
end
|
||||
|
||||
it "increases when a new object is allocated" do
|
||||
before = ObjectSpace.memsize_of_all(Class)
|
||||
o = Class.new
|
||||
after = ObjectSpace.memsize_of_all(Class)
|
||||
c = Class.new
|
||||
before = ObjectSpace.memsize_of_all(c)
|
||||
o = c.new
|
||||
after = ObjectSpace.memsize_of_all(c)
|
||||
after.should > before
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue