@@ -336,8 +336,8 @@ mod tests {
336
336
fn feature_json_invalid_geometry ( ) {
337
337
let geojson_str = r#"{"geometry":3.14,"properties":{},"type":"Feature"}"# ;
338
338
match geojson_str. parse :: < GeoJson > ( ) . unwrap_err ( ) {
339
- Error :: FeatureInvalidGeometryValue ( _ ) => ( ) ,
340
- _ => unreachable ! ( ) ,
339
+ Error :: MalformedJson ( e ) => assert ! ( e . to_string ( ) . contains ( "expected a valid GeoJSON Geometry object" ) ) ,
340
+ other => panic ! ( "expecting FeatureInvalidGeometryValue, but got: {:?}" , other ) ,
341
341
}
342
342
}
343
343
@@ -396,18 +396,18 @@ mod tests {
396
396
#[ test]
397
397
fn decode_feature_with_invalid_id_type_object ( ) {
398
398
let feature_json_str = "{\" geometry\" :{\" coordinates\" :[1.1,2.1],\" type\" :\" Point\" },\" id\" :{},\" properties\" :{},\" type\" :\" Feature\" }" ;
399
- assert ! ( matches! (
400
- feature_json_str . parse :: < GeoJson > ( ) ,
401
- Err ( Error :: FeatureInvalidIdentifierType ( _ ) )
402
- ) ) ;
399
+ match feature_json_str . parse :: < GeoJson > ( ) . unwrap_err ( ) {
400
+ Error :: MalformedJson ( e ) => assert ! ( e . to_string ( ) . contains ( "Id" ) ) ,
401
+ other => panic ! ( "expected different error. Got: {:?}" , other ) ,
402
+ }
403
403
}
404
404
405
405
#[ test]
406
406
fn decode_feature_with_invalid_id_type_null ( ) {
407
407
let feature_json_str = "{\" geometry\" :{\" coordinates\" :[1.1,2.1],\" type\" :\" Point\" },\" id\" :null,\" properties\" :{},\" type\" :\" Feature\" }" ;
408
408
match feature_json_str. parse :: < GeoJson > ( ) . unwrap_err ( ) {
409
- Error :: FeatureInvalidIdentifierType ( _ ) => { } // pass ,
410
- other => panic ! ( "unexpected err : {:?}" , other) ,
409
+ Error :: MalformedJson ( e ) => assert ! ( e . to_string ( ) . contains ( "Id" ) ) ,
410
+ other => panic ! ( "expected different error. Got : {:?}" , other) ,
411
411
}
412
412
}
413
413
0 commit comments