File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ julia> myjoin("/Users/rory/repos", "FilePaths.jl")
3939```
4040"""
4141macro compat (ex)
42- mod = @__MODULE__
42+ mod:: Module = QuoteNode (__module__) . value
4343 new_ex = compat_exp (mod, deepcopy (ex))
4444
4545 return quote
Original file line number Diff line number Diff line change 3737# Test for inline definitions
3838FilePaths. @compat inline (x:: AbstractPath , y:: AbstractPath ) = relative (x, y)
3939
40+
41+ # Test for custom path type
42+ struct MyPath <: AbstractPath
43+ x:: String
4044end
4145
46+ __init__ () = FilePathsBase. register (MyPath)
47+ FilePathsBase. ispathtype (:: Type{MyPath} , str:: AbstractString ) = startswith (str, " mypath://" )
48+
49+ FilePaths. @compat mypath_testem (path:: MyPath ) = " **" * path. x
50+
51+ end # TestPkg module
52+
4253@testset " @compat" begin
4354 cd (abs (parent (Path (@__FILE__ )))) do
4455 reg = Sys. iswindows () ? " ..\\ src\\ FilePaths.jl" : " ../src/FilePaths.jl"
117128 # Mixing strings and paths should also work here
118129 @test TestPkg. inline (string (p), home ()) == relative (p, home ())
119130 end
131+
132+ @testset " Custom path type" begin
133+ @test TestPkg. mypath_testem (TestPkg. MyPath (" mypath://foo" )) == " **mypath://foo"
134+ @test TestPkg. mypath_testem (" mypath://foo" ) == " **mypath://foo"
135+ end
120136 end
121137end
You can’t perform that action at this time.
0 commit comments