Skip to content

Commit 076988c

Browse files
authored
Type roundtrip tests (#1185)
A new set of tests to simply check that we can "roundtrip" a Datum. That is, we return the same value as we were given in a `#[pg_extern]` function argument. Essentially this tests that the type's `FromDatum` and `IntoDatum` impls match, and in the case of arrays, tests that the iterator impl for `Array<T>` works for its individual datums. In doing so, this uncovered a bug with converting a `pg_sys::Point` (and `pg_sys::BOX`) into a Datum, so those are fixed in here as well. The addition of `#[derive(Copy)]` to the "Complex" type in pgrx-tests is just to make it work well with the roundtrip tests here.
1 parent 8ec818f commit 076988c

File tree

4 files changed

+441
-10
lines changed

4 files changed

+441
-10
lines changed

pgrx-tests/src/tests/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ mod pgrx_module_qualification;
4242
mod postgres_type_tests;
4343
mod range_tests;
4444
mod result_tests;
45+
mod roundtrip_tests;
4546
mod schema_tests;
4647
mod shmem_tests;
4748
mod spi_tests;

0 commit comments

Comments
 (0)