Skip to content

Commit 4e361cb

Browse files
committed
add testgs
1 parent 35b83a4 commit 4e361cb

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/differentials.jl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,21 @@
6666
@test (@thunk(3))() == 3
6767
@test (@thunk(@thunk(3)))() isa Thunk
6868
end
69+
70+
@testset "erroring thunks should include the source in the backtrack" begin
71+
expected_line = (@__LINE__) + 2 # for testing it is at right palce
72+
try
73+
x = @thunk(error())
74+
extern(x)
75+
catch err
76+
err isa ErrorException || rethrow()
77+
st = stacktrace(catch_backtrace())
78+
# Should be 2nd last line, as last line will be the `error` function
79+
stackframe = st[2]
80+
@test stackframe.line == expected_line
81+
@test stackframe.file == Symbol(@__FILE__)
82+
end
83+
end
6984
end
7085

7186
@testset "No ambiguities in $f" for f in (+, *)

0 commit comments

Comments
 (0)