Skip to content

Commit a3ada71

Browse files
authored
Merge pull request #24 from timholy/teh/fix_23
Use abspath on filenames
2 parents 32b620c + c8e0e59 commit a3ada71

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/CodeTracking.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ Return the signatures of all methods whose definition spans the specified locati
114114
Returns `nothing` if there are no methods at that location.
115115
"""
116116
function signatures_at(filename::AbstractString, line::Integer)
117+
filename = abspath(filename)
117118
if occursin(juliabase, filename)
118119
rpath = postpath(filename, juliabase)
119120
id = PkgId(Base)
@@ -139,7 +140,7 @@ function signatures_at(filename::AbstractString, line::Integer)
139140
end
140141
end
141142
end
142-
error("$filename not found, perhaps the package is not loaded")
143+
error("$filename not found in internal data, perhaps the package is not loaded (or not loaded with `includet`)")
143144
end
144145

145146
"""

test/runtests.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ using CodeTracking
44
using Test, InteractiveUtils
55
# Note: ColorTypes needs to be installed, but note the intentional absence of `using ColorTypes`
66

7-
include("script.jl")
7+
isdefined(Main, :Revise) ? includet("script.jl") : include("script.jl")
88

99
@testset "CodeTracking.jl" begin
1010
m = first(methods(f1))
@@ -87,5 +87,8 @@ end
8787
@test !isempty(sigs)
8888
sigs = signatures_at(Base.find_source_file(String(m.file)), m.line)
8989
@test !isempty(sigs)
90+
91+
# issue #23
92+
@test !isempty(signatures_at("script.jl", 9))
9093
end
9194
end

0 commit comments

Comments
 (0)