Skip to content

Commit

Permalink
test: make errorshow test more robust
Browse files Browse the repository at this point in the history
(cherry picked from commit 8f0b17b)
  • Loading branch information
vtjnash authored and KristofferC committed Sep 15, 2021
1 parent 28ce0a4 commit 54590dc
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions test/errorshow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ end

# Test that implementation detail of include() is hidden from the user by default
let bt = try
include("testhelpers/include_error.jl")
@noinline include("testhelpers/include_error.jl")
catch
catch_backtrace()
end
Expand All @@ -735,7 +735,7 @@ end
# Test backtrace printing
module B
module C
f(x; y=2.0) = error()
@noinline f(x; y=2.0) = error()
end
module D
import ..C: f
Expand All @@ -744,7 +744,8 @@ module B
end

@testset "backtrace" begin
bt = try B.D.g()
bt = try
B.D.g()
catch
catch_backtrace()
end
Expand Down Expand Up @@ -772,15 +773,17 @@ if Sys.isapple() || (Sys.islinux() && Sys.ARCH === :x86_64)
pair_repeater_b() = pair_repeater_a()

@testset "repeated stack frames" begin
let bt = try single_repeater()
let bt = try
single_repeater()
catch
catch_backtrace()
end
bt_str = sprint(Base.show_backtrace, bt)
@test occursin(r"repeats \d+ times", bt_str)
end

let bt = try pair_repeater_a()
let bt = try
pair_repeater_a()
catch
catch_backtrace()
end
Expand Down

0 comments on commit 54590dc

Please sign in to comment.