File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed
Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -74,6 +74,10 @@ public protocol GeoJSONObjectConvertible {
7474 var geoJSONObject : GeoJSONObject { get }
7575}
7676
77+ extension GeoJSONObject : GeoJSONObjectConvertible {
78+ public var geoJSONObject : GeoJSONObject { return self }
79+ }
80+
7781extension Geometry : GeoJSONObjectConvertible {
7882 public var geoJSONObject : GeoJSONObject { return . geometry( self ) }
7983}
Original file line number Diff line number Diff line change @@ -23,11 +23,16 @@ class GeoJSONTests: XCTestCase {
2323 XCTAssertEqual ( Geometry ( GeometryCollection ( geometries: [ ] ) ) ,
2424 . geometryCollection( GeometryCollection ( geometries: [ ] ) ) )
2525
26+ XCTAssertEqual ( Geometry ( Geometry ( Geometry ( Geometry ( Point ( nullIsland) ) ) ) ) , . point( . init( nullIsland) ) )
27+
2628 XCTAssertEqual ( GeoJSONObject ( Geometry ( Point ( nullIsland) ) ) , . geometry( . point( . init( nullIsland) ) ) )
2729 XCTAssertEqual ( GeoJSONObject ( Feature ( geometry: nil ) ) , . feature( . init( geometry: nil ) ) )
2830 let nullGeometry : Geometry ? = nil
2931 XCTAssertEqual ( GeoJSONObject ( Feature ( geometry: nullGeometry) ) , . feature( . init( geometry: nil ) ) )
3032 XCTAssertEqual ( GeoJSONObject ( FeatureCollection ( features: [ ] ) ) , . featureCollection( . init( features: [ ] ) ) )
33+
34+ XCTAssertEqual ( GeoJSONObject ( GeoJSONObject ( GeoJSONObject ( GeoJSONObject ( Geometry ( Point ( nullIsland) ) ) ) ) ) ,
35+ . geometry( . point( . init( nullIsland) ) ) )
3136 }
3237
3338 func testPoint( ) {
You can’t perform that action at this time.
0 commit comments