Skip to content

Commit d36f8e3

Browse files
committed
Test breakpoint location for kwarg functions
1 parent a3b5baf commit d36f8e3

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

test/breakpoints.jl

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,23 @@ function loop_radius2(n)
77
s
88
end
99

10+
tmppath = ""
11+
if isdefined(Main, :Revise)
12+
global tmppath
13+
tmppath, io = mktemp()
14+
print(io, """
15+
function jikwfunc(x, y=0; z="hello")
16+
a = x + y
17+
b = z^a
18+
return length(b)
19+
end
20+
""")
21+
close(io)
22+
includet(tmppath)
23+
end
24+
25+
using JuliaInterpreter, Test
26+
1027
@testset "Breakpoints" begin
1128
breakpoint(radius2)
1229
stack = JuliaStackFrame[]
@@ -78,6 +95,13 @@ end
7895
frame = JuliaInterpreter.enter_call(loop_radius2, 2)
7996
ret = @interpret JuliaInterpreter.locals(frame)
8097
@test isa(bp, JuliaInterpreter.BreakpointRef)
98+
# Test kwarg method
99+
bp = breakpoint(tmppath, 3)
100+
stack, bp2 = @interpret jikwfunc(2)
101+
@test bp2 == bp
102+
var = JuliaInterpreter.locals(stack[end])
103+
@test !any(v->v.name == :b, var)
104+
@test filter(v->v.name == :a, var)[1].value == 2
81105
end
82106

83107
# Direct return
@@ -136,3 +160,7 @@ end
136160
show(io, bp)
137161
@test String(take!(io)) == "breakpoint(loop_radius2(n) in $(@__MODULE__) at $(@__FILE__):3, 3, ArgumentError(\"whoops\"))"
138162
end
163+
164+
if tmppath != ""
165+
rm(tmppath)
166+
end

0 commit comments

Comments
 (0)