Skip to content

Commit

Permalink
Add specs for require objspace/trace
Browse files Browse the repository at this point in the history
  • Loading branch information
ytjmt authored and eregon committed Jan 4, 2023
1 parent 71a3af7 commit 4714033
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
5 changes: 5 additions & 0 deletions library/objectspace/fixtures/trace.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
require "objspace/trace"
a = "foo"
b = "b" + "a" + "r"
c = 42
p a, b, c
15 changes: 15 additions & 0 deletions library/objectspace/trace_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
require_relative '../../spec_helper'

ruby_version_is "3.1" do
describe 'require "objspace/trace"' do
it "shows object allocation sites" do
file = fixture(__FILE__ , "trace.rb")
ruby_exe(file, args: "2>&1").lines(chomp: true).should == [
"objspace/trace is enabled",
"\"foo\" @ #{file}:2",
"\"bar\" @ #{file}:3",
"42"
]
end
end
end

0 comments on commit 4714033

Please sign in to comment.