Skip to content

Commit

Permalink
Add more backtrace tests
Browse files Browse the repository at this point in the history
  • Loading branch information
timholy committed Aug 8, 2016
1 parent de762cd commit af2612d
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions test/backtrace.jl
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,46 @@ let
@test i1 > 0 && i2 > 0
@test b1[i1].line != b2[i2].line
end

module BackTraceTesting

using Base.Test

@inline bt2() = backtrace()
@inline bt1() = bt2()
bt() = bt1()

lkup = map(StackTraces.lookup, bt())
hasbt = hasbt2 = false
for sfs in lkup
for sf in sfs
if sf.func == :bt
hasbt = true
end
if sf.func == :bt2
hasbt2 = true
end
end
end
@test hasbt
@test_broken hasbt2

function btmacro()
@time backtrace()
end
lkup = map(StackTraces.lookup, btmacro())
hasme = hasbtmacro = false
for sfs in lkup
for sf in sfs
if sf.func == Symbol("macro expansion")
hasme = true
end
if sf.func == :btmacro
hasbtmacro = true
end
end
end
@test hasme
@test hasbtmacro

end

0 comments on commit af2612d

Please sign in to comment.