Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/CodeTracking.jl
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ Return the signatures of all methods whose definition spans the specified locati
Returns `nothing` if there are no methods at that location.
"""
function signatures_at(filename::AbstractString, line::Integer)
filename = abspath(filename)
if occursin(juliabase, filename)
rpath = postpath(filename, juliabase)
id = PkgId(Base)
Expand All @@ -139,7 +140,7 @@ function signatures_at(filename::AbstractString, line::Integer)
end
end
end
error("$filename not found, perhaps the package is not loaded")
error("$filename not found in internal data, perhaps the package is not loaded (or not loaded with `includet`)")
end

"""
Expand Down
5 changes: 4 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ using CodeTracking
using Test, InteractiveUtils
# Note: ColorTypes needs to be installed, but note the intentional absence of `using ColorTypes`

include("script.jl")
isdefined(Main, :Revise) ? includet("script.jl") : include("script.jl")

@testset "CodeTracking.jl" begin
m = first(methods(f1))
Expand Down Expand Up @@ -87,5 +87,8 @@ end
@test !isempty(sigs)
sigs = signatures_at(Base.find_source_file(String(m.file)), m.line)
@test !isempty(sigs)

# issue #23
@test !isempty(signatures_at("script.jl", 9))
end
end