Skip to content

Commit

Permalink
Add spec for eval with custom file/line
Browse files Browse the repository at this point in the history
No further changes needed to support this, but I want to add the
extra coverage for weird things so that in the future we avoid any
regressions.
  • Loading branch information
ivoanjo committed May 20, 2022
1 parent d59b04f commit ad5c876
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions spec/datadog/profiling/collectors/stack_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,25 @@ def call_sleep
)
end
end

context 'when sampling an eval with a custom file and line provided' do
let(:do_in_background_thread) do
proc do |ready_queue|
ready_queue << true
eval('sleep', binding, '/this/is/a/fake_file_.rb', -123456789)
end
end

it 'matches the Ruby backtrace API' do
expect(gathered_stack).to eq reference_stack
end

it 'has a frame with the custom file and line provided on the stack' do
expect(reference_stack).to include(
hash_including(path: '/this/is/a/fake_file_.rb', lineno: -123456789),
)
end
end
# rubocop:enable Style/EvalWithLocation
end

Expand Down

0 comments on commit ad5c876

Please sign in to comment.