diff --git a/sqlx-test/src/lib.rs b/sqlx-test/src/lib.rs index dbc503529b..fe9296c012 100644 --- a/sqlx-test/src/lib.rs +++ b/sqlx-test/src/lib.rs @@ -51,11 +51,17 @@ macro_rules! test_type { } }; - ($name:ident<$ty:ty>($db:ident, $($text:literal @= $value:expr),+ $(,)?)) => { + ($name:ident<$ty:ty>($db:ident, $($text:literal ~= $value:expr),+ $(,)?)) => { paste::item! { $crate::__test_prepared_type!($name<$ty>($db, $crate::[< $db _query_for_test_prepared_geometric_type >]!(), $($text == $value),+)); } }; + ($name:ident<$ty:ty>($db:ident, $($text:literal = $value:expr),+ $(,)?)) => { + paste::item! { + $crate::__test_prepared_type!($name<$ty>($db, $crate::[< $db _query_for_test_prepared_geometric_type >]!(), $($text == $value),+)); + } + }; + ($name:ident($db:ident, $($text:literal == $value:expr),+ $(,)?)) => { $crate::test_type!($name<$name>($db, $($text == $value),+)); @@ -233,6 +239,13 @@ macro_rules! Postgres_query_for_test_prepared_type { #[macro_export] macro_rules! Postgres_query_for_test_prepared_geometric_type { + () => { + "SELECT ({0} ~= $1)::int4, {0}, $2" + }; +} + +#[macro_export] +macro_rules! Postgres_query_for_test_prepared_geometric_array_type { () => { "SELECT ({0} = $1)::int4, {0}, $2" }; diff --git a/tests/postgres/types.rs b/tests/postgres/types.rs index 64a41eddd5..4a75bec57c 100644 --- a/tests/postgres/types.rs +++ b/tests/postgres/types.rs @@ -494,13 +494,13 @@ test_type!(_cube>(Postgres, #[cfg(any(postgres_12, postgres_13, postgres_14, postgres_15))] test_type!(point(Postgres, - "point(2.2,-3.4)" @= sqlx::postgres::types::PgPoint { x: 2.2, y:-3.4 }, + "point(2.2,-3.4)" ~= sqlx::postgres::types::PgPoint { x: 2.2, y:-3.4 }, )); #[cfg(any(postgres_12, postgres_13, postgres_14, postgres_15))] test_type!(_point>(Postgres, - "array[point(2,3),point(2.1,3.4)]" @= vec![sqlx::postgres::types::PgPoint { x:2., y: 3. }, sqlx::postgres::types::PgPoint { x:2.1, y: 3.4 }], - "array[point(2.2,-3.4)]" @= vec![sqlx::postgres::types::PgPoint { x: 2.2, y: -3.4 }], + "array[point(2,3),point(2.1,3.4)]" = vec![sqlx::postgres::types::PgPoint { x:2., y: 3. }, sqlx::postgres::types::PgPoint { x:2.1, y: 3.4 }], + "array[point(2.2,-3.4)]" = vec![sqlx::postgres::types::PgPoint { x: 2.2, y: -3.4 }], )); #[cfg(feature = "rust_decimal")]