diff --git a/Cargo.lock b/Cargo.lock index 3c2da29..c705649 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -329,6 +329,25 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "include_dir" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "923d117408f1e49d914f1a379a309cffe4f18c05cf4e3d12e613a15fc81bd0dd" +dependencies = [ + "include_dir_macros", +] + +[[package]] +name = "include_dir_macros" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cab85a7ed0bd5f0e76d93846e0147172bed2e2d3f859bcc33a8d9699cad1a75" +dependencies = [ + "proc-macro2", + "quote", +] + [[package]] name = "itertools" version = "0.13.0" @@ -451,6 +470,7 @@ dependencies = [ "flate2", "generativity", "glob", + "include_dir", "libc", "pretty_assertions", "prettyplease", diff --git a/Cargo.toml b/Cargo.toml index b8b16ce..bbcb2e9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,11 +11,13 @@ repository = "https://github.com/pgdogdev/pg_raw_parse" # Enables compile-time checks to verify that our enums are actually layout # identical to the C structures we're casting from. Requires a nightly compiler field_offset_assertions = [] +postgres-regress = ["dep:include_dir"] [dependencies] generativity = "1.2.1" libc = "0.2.186" thiserror = "2.0.18" +include_dir = { version = "0.7", optional = true } [build-dependencies] bindgen = "0.72.1" diff --git a/src/lib.rs b/src/lib.rs index 0ed0cdb..c6a2601 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -27,6 +27,10 @@ pub use crate::owned::Owned; /// PostgreSQL version number whose parser sources are used by this crate. pub const POSTGRES_VERSION_NUM: u32 = raw::PG_VERSION_NUM; +#[cfg(feature = "postgres-regress")] +pub static POSTGRES_REGRESS: include_dir::Dir<'static> = + include_dir::include_dir!("$CARGO_MANIFEST_DIR/libpg_query/test/sql/postgres_regress"); + /// Returns the PostgreSQL version whose parser sources are used by this crate. pub fn postgres_version() -> &'static str { CStr::from_bytes_with_nul(raw::PG_VERSION)