⚲
Project
General
Profile
Sign in
Register
Home
Projects
Help
Search
:
Ruby master
All Projects
Ruby
»
Ruby master
Overview
Activity
Roadmap
Issues
Repository
Like
Download (790 Bytes)
Bug #17302
ยป my_test.rb
liran.last@gmail.com (Liran Haimovitch)
, 11/01/2020 11:53 AM
require
'minitest/autorun'
describe
"my_bug"
do
it
"traces two :line events in the same method"
do
ScratchPad
=
[]
trace1
=
TracePoint
.
new
(
:line
)
do
|
tp
|
ScratchPad
<<
tp
.
lineno
end
trace2
=
TracePoint
.
new
(
:line
)
do
|
tp
|
ScratchPad
<<
tp
.
lineno
end
target
=
->
{
x
=
1
# <= this line is target1
y
=
2
z
=
x
+
y
# <= this line is target2
}
_
,
lineno
=
target
.
source_location
target_line1
=
lineno
+
1
target_line2
=
lineno
+
3
trace1
.
enable
(
target_line:
target_line1
,
target:
target
)
trace2
.
enable
(
target_line:
target_line2
,
target:
target
)
target
.
call
trace1
.
disable
trace2
.
disable
assert_equal
[
target_line1
,
target_line2
],
ScratchPad
end
end
(1-1/1)
Loading...