diff --git a/martin/src/bin/martin-cp.rs b/martin/src/bin/martin-cp.rs index 7fe50d156..897bc72ad 100644 --- a/martin/src/bin/martin-cp.rs +++ b/martin/src/bin/martin-cp.rs @@ -458,46 +458,31 @@ mod tests { let bbox_mi = Bounds::from_str("-86.6271,41.6811,-82.3095,45.8058").unwrap(); let bbox_usa = Bounds::from_str("-124.8489,24.3963,-66.8854,49.3843").unwrap(); - assert_yaml_snapshot!(compute_tile_ranges(&args(&[world], &[0])), @r###" - --- - - "0: (0,0) - (0,0)" - "###); + assert_yaml_snapshot!(compute_tile_ranges(&args(&[world], &[0])), @r#"- "0: (0,0) - (0,0)""#); - assert_yaml_snapshot!(compute_tile_ranges(&args(&[world], &[3,7])), @r###" - --- + assert_yaml_snapshot!(compute_tile_ranges(&args(&[world], &[3,7])), @r#" - "3: (0,0) - (7,7)" - "7: (0,0) - (127,127)" - "###); + "#); - assert_yaml_snapshot!(compute_tile_ranges(&arg_minmax(&[world], 2, 4)), @r###" - --- + assert_yaml_snapshot!(compute_tile_ranges(&arg_minmax(&[world], 2, 4)), @r#" - "2: (0,0) - (3,3)" - "3: (0,0) - (7,7)" - "4: (0,0) - (15,15)" - "###); + "#); - assert_yaml_snapshot!(compute_tile_ranges(&args(&[world], &[14])), @r###" - --- - - "14: (0,0) - (16383,16383)" - "###); + assert_yaml_snapshot!(compute_tile_ranges(&args(&[world], &[14])), @r#"- "14: (0,0) - (16383,16383)""#); - assert_yaml_snapshot!(compute_tile_ranges(&args(&[bbox_usa], &[14])), @r###" - --- - - "14: (2509,5599) - (5147,7046)" - "###); + assert_yaml_snapshot!(compute_tile_ranges(&args(&[bbox_usa], &[14])), @r#"- "14: (2509,5599) - (5147,7046)""#); - assert_yaml_snapshot!(compute_tile_ranges(&args(&[bbox_usa, bbox_mi, bbox_ca], &[14])), @r###" - --- - - "14: (2509,5599) - (5147,7046)" - "###); + assert_yaml_snapshot!(compute_tile_ranges(&args(&[bbox_usa, bbox_mi, bbox_ca], &[14])), @r#"- "14: (2509,5599) - (5147,7046)""#); - assert_yaml_snapshot!(compute_tile_ranges(&args(&[bbox_ca_south, bbox_mi, bbox_ca], &[14])), @r###" - --- + assert_yaml_snapshot!(compute_tile_ranges(&args(&[bbox_ca_south, bbox_mi, bbox_ca], &[14])), @r#" - "14: (2791,6499) - (2997,6624)" - "14: (4249,5841) - (4446,6101)" - "14: (2526,6081) - (2790,6624)" - "14: (2791,6081) - (2997,6498)" - "###); + "#); } fn args(bbox: &[Bounds], zooms: &[u8]) -> CopyArgs { diff --git a/martin/src/pg/builder.rs b/martin/src/pg/builder.rs index 4b88f2f93..cf81abc4b 100644 --- a/martin/src/pg/builder.rs +++ b/martin/src/pg/builder.rs @@ -496,95 +496,86 @@ mod tests { #[allow(clippy::too_many_lines)] fn test_auto_publish_no_auto() { let cfg = auto("{}"); - assert_yaml_snapshot!(cfg, @r###" - --- - auto_table: - source_id_format: "{table}" - auto_funcs: - source_id_format: "{function}" - "###); + assert_yaml_snapshot!(cfg, @r#" + auto_table: + source_id_format: "{table}" + auto_funcs: + source_id_format: "{function}" + "#); let cfg = auto("tables: {}"); - assert_yaml_snapshot!(cfg, @r###" - --- - auto_table: ~ - auto_funcs: ~ - "###); + assert_yaml_snapshot!(cfg, @r" + auto_table: ~ + auto_funcs: ~ + "); let cfg = auto("functions: {}"); - assert_yaml_snapshot!(cfg, @r###" - --- - auto_table: ~ - auto_funcs: ~ - "###); + assert_yaml_snapshot!(cfg, @r" + auto_table: ~ + auto_funcs: ~ + "); let cfg = auto("auto_publish: true"); - assert_yaml_snapshot!(cfg, @r###" - --- - auto_table: - source_id_format: "{table}" - auto_funcs: - source_id_format: "{function}" - "###); + assert_yaml_snapshot!(cfg, @r#" + auto_table: + source_id_format: "{table}" + auto_funcs: + source_id_format: "{function}" + "#); let cfg = auto("auto_publish: false"); - assert_yaml_snapshot!(cfg, @r###" - --- - auto_table: ~ - auto_funcs: ~ - "###); + assert_yaml_snapshot!(cfg, @r" + auto_table: ~ + auto_funcs: ~ + "); let cfg = auto(indoc! {" auto_publish: from_schemas: public tables: true"}); - assert_yaml_snapshot!(cfg, @r###" - --- - auto_table: - schemas: - - public - source_id_format: "{table}" - auto_funcs: ~ - "###); + assert_yaml_snapshot!(cfg, @r#" + auto_table: + schemas: + - public + source_id_format: "{table}" + auto_funcs: ~ + "#); let cfg = auto(indoc! {" auto_publish: from_schemas: public functions: true"}); - assert_yaml_snapshot!(cfg, @r###" - --- - auto_table: ~ - auto_funcs: - schemas: - - public - source_id_format: "{function}" - "###); + assert_yaml_snapshot!(cfg, @r#" + auto_table: ~ + auto_funcs: + schemas: + - public + source_id_format: "{function}" + "#); let cfg = auto(indoc! {" auto_publish: from_schemas: public tables: false"}); - assert_yaml_snapshot!(cfg, @r###" - --- - auto_table: ~ - auto_funcs: - schemas: - - public - source_id_format: "{function}" - "###); + assert_yaml_snapshot!(cfg, @r#" + auto_table: ~ + auto_funcs: + schemas: + - public + source_id_format: "{function}" + "#); let cfg = auto(indoc! {" auto_publish: from_schemas: public functions: false"}); - assert_yaml_snapshot!(cfg, @r###" - --- - auto_table: - schemas: - - public - source_id_format: "{table}" - auto_funcs: ~ - "###); + assert_yaml_snapshot!(cfg, @r#" + auto_table: + schemas: + - public + source_id_format: "{table}" + auto_funcs: ~ + "#); let cfg = auto(indoc! {" auto_publish: @@ -592,15 +583,14 @@ mod tests { tables: from_schemas: osm id_format: 'foo_{schema}.{table}_bar'"}); - assert_yaml_snapshot!(cfg, @r###" - --- - auto_table: - schemas: - - osm - - public - source_id_format: "foo_{schema}.{table}_bar" - auto_funcs: ~ - "###); + assert_yaml_snapshot!(cfg, @r#" + auto_table: + schemas: + - osm + - public + source_id_format: "foo_{schema}.{table}_bar" + auto_funcs: ~ + "#); let cfg = auto(indoc! {" auto_publish: @@ -608,15 +598,14 @@ mod tests { tables: from_schemas: osm source_id_format: '{schema}.{table}'"}); - assert_yaml_snapshot!(cfg, @r###" - --- + assert_yaml_snapshot!(cfg, @r#" auto_table: schemas: - osm - public source_id_format: "{schema}.{table}" auto_funcs: ~ - "###); + "#); let cfg = auto(indoc! {" auto_publish: @@ -624,14 +613,13 @@ mod tests { from_schemas: - osm - public"}); - assert_yaml_snapshot!(cfg, @r###" - --- - auto_table: - schemas: - - osm - - public - source_id_format: "{table}" - auto_funcs: ~ - "###); + assert_yaml_snapshot!(cfg, @r#" + auto_table: + schemas: + - osm + - public + source_id_format: "{table}" + auto_funcs: ~ + "#); } } diff --git a/martin/tests/mb_server_test.rs b/martin/tests/mb_server_test.rs index 327a88fe4..19f053f4d 100644 --- a/martin/tests/mb_server_test.rs +++ b/martin/tests/mb_server_test.rs @@ -53,8 +53,7 @@ async fn mbt_get_catalog() { let response = call_service(&app, req).await; let response = assert_response(response).await; let body: serde_json::Value = read_body_json(response).await; - assert_yaml_snapshot!(body, @r###" - --- + assert_yaml_snapshot!(body, @r" fonts: {} sprites: {} tiles: @@ -73,7 +72,7 @@ async fn mbt_get_catalog() { m_webp: content_type: image/webp name: ne2sr - "###); + "); } #[actix_rt::test] @@ -85,8 +84,7 @@ async fn mbt_get_catalog_gzip() { let response = assert_response(response).await; let body = decode_gzip(&read_body(response).await).unwrap(); let body: serde_json::Value = serde_json::from_slice(&body).unwrap(); - assert_yaml_snapshot!(body, @r###" - --- + assert_yaml_snapshot!(body, @r" fonts: {} sprites: {} tiles: @@ -105,7 +103,7 @@ async fn mbt_get_catalog_gzip() { m_webp: content_type: image/webp name: ne2sr - "###); + "); } #[actix_rt::test] diff --git a/martin/tests/pg_function_source_test.rs b/martin/tests/pg_function_source_test.rs index f10af4829..cf7d81718 100644 --- a/martin/tests/pg_function_source_test.rs +++ b/martin/tests/pg_function_source_test.rs @@ -17,14 +17,13 @@ fn init() { async fn function_source_tilejson() { let mock = mock_sources(mock_pgcfg("connection_string: $DATABASE_URL")).await; let tj = source(&mock, "function_zxy_query").get_tilejson(); - assert_yaml_snapshot!(tj, @r###" - --- + assert_yaml_snapshot!(tj, @r" tilejson: 3.0.0 tiles: [] name: function_zxy_query foo: bar: foo - "###); + "); } #[actix_rt::test] @@ -55,10 +54,9 @@ async fn function_source_schemas() { from_schemas: MixedCase "}); let sources = mock_sources(cfg).await.0.tiles; - assert_yaml_snapshot!(sources.get_catalog(), @r###" - --- + assert_yaml_snapshot!(sources.get_catalog(), @r" function_Mixed_Name: content_type: application/x-protobuf description: a function source with MixedCase name - "###); + "); } diff --git a/martin/tests/pg_server_test.rs b/martin/tests/pg_server_test.rs index 7fa96d2cf..34ca2dc0d 100644 --- a/martin/tests/pg_server_test.rs +++ b/martin/tests/pg_server_test.rs @@ -53,7 +53,6 @@ postgres: let body = read_body(response).await; let body: serde_json::Value = serde_json::from_slice(&body).unwrap(); assert_yaml_snapshot!(body, @r#" - --- fonts: {} sprites: {} tiles: @@ -188,8 +187,7 @@ postgres: .insert_header(("x-rewrite-url", "/tiles/table_source?token=martin")) .to_request(); let result: TileJSON = call_and_read_body_json(&app, req).await; - assert_yaml_snapshot!(result, @r###" - --- + assert_yaml_snapshot!(result, @r#" tilejson: 3.0.0 tiles: - "http://localhost:8080/tiles/table_source/{z}/{x}/{y}?token=martin" @@ -205,7 +203,7 @@ postgres: name: table_source foo: bar: foo - "###); + "#); } #[actix_rt::test] @@ -1025,8 +1023,7 @@ tables: assert_eq!(src.id_column, None); assert!(matches!(&src.properties, Some(v) if v.len() == 1)); let tj = source(&mock, "no_id").get_tilejson(); - assert_yaml_snapshot!(tj, @r###" - --- + assert_yaml_snapshot!(tj, @r" tilejson: 3.0.0 tiles: [] vector_layers: @@ -1041,10 +1038,9 @@ tables: - 90 description: a description from comment on table name: no_id - "###); + "); - assert_yaml_snapshot!(table(&mock, "id_only"), @r###" - --- + assert_yaml_snapshot!(table(&mock, "id_only"), @r" schema: MixedCase table: MixPoints srid: 4326 @@ -1058,10 +1054,9 @@ tables: geometry_type: POINT properties: TABLE: text - "###); + "); - assert_yaml_snapshot!(table(&mock, "id_and_prop"), @r###" - --- + assert_yaml_snapshot!(table(&mock, "id_and_prop"), @r" schema: MixedCase table: MixPoints srid: 4326 @@ -1076,10 +1071,9 @@ tables: properties: TABLE: text giD: int4 - "###); + "); - assert_yaml_snapshot!(table(&mock, "prop_only"), @r###" - --- + assert_yaml_snapshot!(table(&mock, "prop_only"), @r" schema: MixedCase table: MixPoints srid: 4326 @@ -1093,7 +1087,7 @@ tables: properties: TABLE: text giD: int4 - "###); + "); // -------------------------------------------- diff --git a/martin/tests/pg_table_source_test.rs b/martin/tests/pg_table_source_test.rs index 9628d58eb..7b1cbd6b4 100644 --- a/martin/tests/pg_table_source_test.rs +++ b/martin/tests/pg_table_source_test.rs @@ -16,7 +16,6 @@ fn init() { async fn table_source() { let mock = mock_sources(mock_pgcfg("connection_string: $DATABASE_URL")).await; assert_yaml_snapshot!(mock.0.tiles.get_catalog(), @r#" - --- "-function.withweired---_-characters": content_type: application/x-protobuf description: a function source with special characters @@ -91,8 +90,7 @@ async fn table_source() { "#); let source = table(&mock, "table_source"); - assert_yaml_snapshot!(source, @r###" - --- + assert_yaml_snapshot!(source, @r" schema: public table: table_source srid: 4326 @@ -105,15 +103,14 @@ async fn table_source() { geometry_type: GEOMETRY properties: gid: int4 - "###); + "); } #[actix_rt::test] async fn tables_tilejson() { let mock = mock_sources(mock_pgcfg("connection_string: $DATABASE_URL")).await; let tj = source(&mock, "table_source").get_tilejson(); - assert_yaml_snapshot!(tj, @r###" - --- + assert_yaml_snapshot!(tj, @r" tilejson: 3.0.0 tiles: [] vector_layers: @@ -128,7 +125,7 @@ async fn tables_tilejson() { name: table_source foo: bar: foo - "###); + "); } #[actix_rt::test] @@ -184,10 +181,9 @@ async fn table_source_schemas() { functions: false "}); let sources = mock_sources(cfg).await.0; - assert_yaml_snapshot!(sources.tiles.get_catalog(), @r###" - --- + assert_yaml_snapshot!(sources.tiles.get_catalog(), @r" MixPoints: content_type: application/x-protobuf description: a description from comment on table - "###); + "); } diff --git a/martin/tests/pmt_server_test.rs b/martin/tests/pmt_server_test.rs index 63e8f775c..a7a26bbd6 100644 --- a/martin/tests/pmt_server_test.rs +++ b/martin/tests/pmt_server_test.rs @@ -51,14 +51,13 @@ async fn pmt_get_catalog() { let response = call_service(&app, req).await; let response = assert_response(response).await; let body: serde_json::Value = read_body_json(response).await; - assert_yaml_snapshot!(body, @r###" - --- + assert_yaml_snapshot!(body, @r" fonts: {} sprites: {} tiles: stamen_toner__raster_CC-BY-ODbL_z3: content_type: image/png - "###); + "); } #[actix_rt::test] @@ -70,14 +69,13 @@ async fn pmt_get_catalog_gzip() { let response = assert_response(response).await; let body = decode_gzip(&read_body(response).await).unwrap(); let body: serde_json::Value = serde_json::from_slice(&body).unwrap(); - assert_yaml_snapshot!(body, @r###" - --- + assert_yaml_snapshot!(body, @r" fonts: {} sprites: {} tiles: p_png: content_type: image/png - "###); + "); } #[actix_rt::test] diff --git a/mbtiles/src/summary.rs b/mbtiles/src/summary.rs index 095a194a7..c63082c7e 100644 --- a/mbtiles/src/summary.rs +++ b/mbtiles/src/summary.rs @@ -202,8 +202,7 @@ mod tests { init_mbtiles_schema(&mut conn, MbtType::Flat).await.unwrap(); let res = mbt.summary(&mut conn).await?; - assert_yaml_snapshot!(res, @r###" - --- + assert_yaml_snapshot!(res, @r" file_size: ~ mbt_type: Flat page_size: 512 @@ -216,7 +215,7 @@ mod tests { min_zoom: ~ max_zoom: ~ zoom_info: [] - "###); + "); Ok(()) } @@ -228,8 +227,7 @@ mod tests { let res = mbt.summary(&mut conn).await?; - assert_yaml_snapshot!(res, @r###" - --- + assert_yaml_snapshot!(res, @r" file_size: 49152 mbt_type: Flat page_size: 4096 @@ -316,7 +314,7 @@ mod tests { - -40.97989806962015 - 180.00000000000003 - 61.60639637138628 - "###); + "); Ok(()) }