Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 87a4382

Browse files
committedMar 17, 2020
Fix tests
1 parent e278dde commit 87a4382

File tree

3 files changed

+28
-20
lines changed

3 files changed

+28
-20
lines changed
 

‎test/backtrace.jl

+21-17
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,18 @@ function get_bt_frames(functionname, bt)
1616
end
1717

1818
# same-file inline
19-
eval(Expr(:function, Expr(:call, :test_inline_1),
20-
Expr(:block, Expr(:line, 99, Symbol("backtrace.jl")),
21-
Expr(:block, Expr(:line, 42),
22-
Expr(:meta, :push_loc, Symbol("backtrace.jl"), :inlfunc),
23-
Expr(:line, 37),
24-
Expr(:call, :throw, "foo"),
25-
Expr(:meta, :pop_loc),
26-
Expr(:line, 99)))))
19+
eval(Expr(:block,
20+
Expr(:line, 101, Symbol("backtrace.jl")),
21+
Expr(:function, Expr(:call, :test_inline_1),
22+
Expr(:block, Expr(:line, 99, Symbol("backtrace.jl")),
23+
Expr(:block, Expr(:line, 42),
24+
Expr(:meta, :push_loc, Symbol("backtrace.jl"), :inlfunc),
25+
Expr(:line, 37),
26+
Expr(:call, :throw, "foo"),
27+
Expr(:meta, :pop_loc),
28+
Expr(:line, 99))))))
2729

28-
@test functionloc(test_inline_1) == ("backtrace.jl", 99)
30+
@test functionloc(test_inline_1) == ("backtrace.jl", 101)
2931
try
3032
test_inline_1()
3133
error("unexpected")
@@ -42,15 +44,17 @@ end
4244

4345
# different-file inline
4446
const absfilepath = Sys.iswindows() ? "C:\\foo\\bar\\baz.jl" : "/foo/bar/baz.jl"
45-
eval(Expr(:function, Expr(:call, :test_inline_2),
46-
Expr(:block, Expr(:line, 81, Symbol("backtrace.jl")),
47-
Expr(:block, Expr(:meta, :push_loc, Symbol(absfilepath)),
48-
Expr(:line, 111),
49-
Expr(:call, :throw, "foo"),
50-
Expr(:meta, :pop_loc),
51-
Expr(:line, 99)))))
47+
eval(Expr(:block,
48+
Expr(:line, 101, Symbol("backtrace.jl")),
49+
Expr(:function, Expr(:call, :test_inline_2),
50+
Expr(:block, Expr(:line, 81, Symbol("backtrace.jl")),
51+
Expr(:block, Expr(:meta, :push_loc, Symbol(absfilepath)),
52+
Expr(:line, 111),
53+
Expr(:call, :throw, "foo"),
54+
Expr(:meta, :pop_loc),
55+
Expr(:line, 99))))))
5256

53-
@test functionloc(test_inline_2) == ("backtrace.jl", 81)
57+
@test functionloc(test_inline_2) == ("backtrace.jl", 101)
5458
try
5559
test_inline_2()
5660
error("unexpected")

‎test/reflection.jl

+3-2
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ let rts = return_types(TLayout)
288288
end
289289

290290
# issue #15447
291+
f15447_line = @__LINE__() + 1
291292
@noinline function f15447(s, a)
292293
if s
293294
return a
@@ -296,15 +297,15 @@ end
296297
return nb
297298
end
298299
end
299-
@test functionloc(f15447)[2] > 0
300+
@test functionloc(f15447)[2] == f15447_line
300301

301302
# issue #14346
302303
@noinline function f14346(id, mask, limit)
303304
if id <= limit && mask[id]
304305
return true
305306
end
306307
end
307-
@test functionloc(f14346)[2] == @__LINE__() - 4
308+
@test functionloc(f14346)[2] == @__LINE__() - 5
308309

309310
# issue #15714
310311
# show variable names for slots and suppress spurious type warnings

‎test/syntax.jl

+4-1
Original file line numberDiff line numberDiff line change
@@ -1037,7 +1037,10 @@ end
10371037

10381038
let f(x) =
10391039
g(x) = 1
1040-
@test functionloc(f(1))[2] > functionloc(f)[2]
1040+
# After fixing functionloc to point to the definition line for multiline
1041+
# functions, short form functions within expressions may get the wrong
1042+
# location without parser changes.
1043+
@test_broken functionloc(f(1))[2] > functionloc(f)[2]
10411044
end
10421045

10431046
# let-bound functions with `where` and static parameters

0 commit comments

Comments
 (0)
Please sign in to comment.