diff --git a/src/CodeTracking.jl b/src/CodeTracking.jl index 9e8e5f5..7355da5 100644 --- a/src/CodeTracking.jl +++ b/src/CodeTracking.jl @@ -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) @@ -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 """ diff --git a/test/runtests.jl b/test/runtests.jl index 84eea2d..db725ac 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -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)) @@ -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