| 31 | namespace parquet { |
| 32 | |
| 33 | TEST(UtilJsonInternal, InvalidProjJsonIsEscaped) { |
| 34 | ::arrow::ExtensionTypeGuard guard(test::geoarrow_wkb()); |
| 35 | |
| 36 | auto metadata = ::arrow::key_value_metadata( |
| 37 | {"proj"}, {R"({"a":[1,2,]})"}); // Invalid JSON (trailing comma) |
| 38 | |
| 39 | auto logical_type = LogicalType::Geometry("projjson:proj"); |
| 40 | |
| 41 | ASSERT_OK_AND_ASSIGN( |
| 42 | auto type, GeoArrowTypeFromLogicalType(*logical_type, metadata, ::arrow::binary())); |
| 43 | |
| 44 | auto extension = std::dynamic_pointer_cast<::arrow::ExtensionType>(type); |
| 45 | ASSERT_NE(extension, nullptr); |
| 46 | |
| 47 | ASSERT_OK_AND_ASSIGN(auto actual, |
| 48 | ::arrow::internal::MinifyJson(extension->Serialize())); |
| 49 | |
| 50 | EXPECT_EQ(actual, "{\"crs\":\"{\\\"a\\\":[1,2,]}\",\"crs_type\":\"projjson\"}"); |
| 51 | } |
| 52 | |
| 53 | TEST(UtilJsonInternal, EscapedCrsKeyIsRecognized) { |
| 54 | std::string metadata = R"({"cr\u0073":"EPSG:3857","crs_type":"authority_code"})"; |
nothing calls this directly
no test coverage detected