Skip to content

Commit 9a779a2

Browse files
committed
test convert Module
1 parent 7c43b17 commit 9a779a2

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/test_primitives.jl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,4 +350,19 @@ end
350350
@test GeoInterface.testfeature(feature)
351351
@test GeoInterface.testfeaturecollection([feature, feature])
352352
end
353+
354+
module ConvertTestModule
355+
using GeoInterface
356+
struct TestPolygon end
357+
traittype(::GeoInterface.PolygonTrait) = TestPolygon
358+
359+
GeoInterface.isgeometry(::TestPolygon) = true
360+
GeoInterface.geomtrait(::TestPolygon) = PolygonTrait()
361+
GeoInterface.ngeom(::PolygonTrait, geom::TestPolygon) = 2
362+
GeoInterface.getgeom(::PolygonTrait, geom::TestPolygon, i) = TestCurve()
363+
GeoInterface.convert(::Type{<:TestPolygon}, ::PolygonTrait, geom) = TestPolygon()
364+
end
365+
366+
@test GeoInterface.convert(ConvertTestModule, MyPolygon()) == ConvertTestModule.TestPolygon()
367+
353368
end

0 commit comments

Comments
 (0)