Skip to content

Commit 59f158c

Browse files
authored
Merge pull request #17818 from JuliaLang/teh/backtrace_testing
Add more backtrace tests
2 parents 2037464 + af2612d commit 59f158c

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

test/backtrace.jl

+43
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,46 @@ let
9696
@test i1 > 0 && i2 > 0
9797
@test b1[i1].line != b2[i2].line
9898
end
99+
100+
module BackTraceTesting
101+
102+
using Base.Test
103+
104+
@inline bt2() = backtrace()
105+
@inline bt1() = bt2()
106+
bt() = bt1()
107+
108+
lkup = map(StackTraces.lookup, bt())
109+
hasbt = hasbt2 = false
110+
for sfs in lkup
111+
for sf in sfs
112+
if sf.func == :bt
113+
hasbt = true
114+
end
115+
if sf.func == :bt2
116+
hasbt2 = true
117+
end
118+
end
119+
end
120+
@test hasbt
121+
@test_broken hasbt2
122+
123+
function btmacro()
124+
@time backtrace()
125+
end
126+
lkup = map(StackTraces.lookup, btmacro())
127+
hasme = hasbtmacro = false
128+
for sfs in lkup
129+
for sf in sfs
130+
if sf.func == Symbol("macro expansion")
131+
hasme = true
132+
end
133+
if sf.func == :btmacro
134+
hasbtmacro = true
135+
end
136+
end
137+
end
138+
@test hasme
139+
@test hasbtmacro
140+
141+
end

0 commit comments

Comments
 (0)