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 2022-06-26 14:50:14 +02:00
parent f616e81637
commit d3d5ef0cca
74 changed files with 1201 additions and 324 deletions

View file

@ -128,4 +128,22 @@ describe "ObjectSpace.trace_object_allocations" do
ObjectSpace.trace_object_allocations_stop
end
end
it "returns nil for class_path, generation, method_id, sourcefile, and sourceline for immutable objects" do
ObjectSpace.trace_object_allocations_start
begin
one = nil
two = 42
three = :foo
[one, two, three].each do |i|
ObjectSpace.allocation_class_path(i).should == nil
ObjectSpace.allocation_generation(i).should == nil
ObjectSpace.allocation_method_id(i).should == nil
ObjectSpace.allocation_sourcefile(i).should == nil
ObjectSpace.allocation_sourceline(i).should == nil
end
ensure
ObjectSpace.trace_object_allocations_stop
end
end
end