Skip to content

Commit

Permalink
Fixup victory lap tests
Browse files Browse the repository at this point in the history
  • Loading branch information
workingjubilee committed Jun 7, 2024
1 parent acec299 commit f6edb6f
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 120 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
use pgrx::aggregate::*;
use pgrx::prelude::*;

const DOG_COMPOSITE_TYPE: &str = "Dog";

struct SumScritches {}

#[pg_aggregate]
impl Aggregate for SumScritches {
type State = i32;
Expand Down Expand Up @@ -54,3 +61,5 @@ impl Aggregate for ScritchCollector {
Some(current)
}
}

fn main() {}
Original file line number Diff line number Diff line change
@@ -1,102 +1,27 @@
error: cannot find attribute `pg_aggregate` in this scope
--> tests/compile-fail/aggregate-functions-dont-run-forever.rs:38:3
|
38 | #[pg_aggregate]
| ^^^^^^^^^^^^
|
help: consider importing one of these items
|
1 + use pgrx::pg_aggregate;
|
1 + use pgrx_macros::pg_aggregate;
|

error: cannot find attribute `pg_aggregate` in this scope
--> tests/compile-fail/aggregate-functions-dont-run-forever.rs:1:3
|
1 | #[pg_aggregate]
| ^^^^^^^^^^^^
|
help: consider importing one of these items
|
1 + use pgrx::pg_aggregate;
|
1 + use pgrx_macros::pg_aggregate;
|

error[E0405]: cannot find trait `Aggregate` in this scope
--> tests/compile-fail/aggregate-functions-dont-run-forever.rs:2:6
|
2 | impl Aggregate for SumScritches {
| ^^^^^^^^^ not found in this scope
|
help: consider importing this trait
|
1 + use pgrx::Aggregate;
|

error[E0412]: cannot find type `SumScritches` in this scope
--> tests/compile-fail/aggregate-functions-dont-run-forever.rs:2:20
|
2 | impl Aggregate for SumScritches {
| ^^^^^^^^^^^^ not found in this scope

error[E0433]: failed to resolve: use of undeclared crate or module `pg_sys`
--> tests/compile-fail/aggregate-functions-dont-run-forever.rs:10:18
|
10 | _fcinfo: pg_sys::FunctionCallInfo,
| ^^^^^^ use of undeclared crate or module `pg_sys`
|
help: consider importing one of these items
|
1 + use pgrx::pg_sys;
|
1 + use pgrx::prelude::pg_sys;
|

error[E0405]: cannot find trait `Aggregate` in this scope
--> tests/compile-fail/aggregate-functions-dont-run-forever.rs:39:6
|
39 | impl Aggregate for ScritchCollector {
| ^^^^^^^^^ not found in this scope
|
help: consider importing this trait
|
1 + use pgrx::Aggregate;
|

error[E0433]: failed to resolve: use of undeclared crate or module `pg_sys`
--> tests/compile-fail/aggregate-functions-dont-run-forever.rs:46:18
|
46 | _fcinfo: pg_sys::FunctionCallInfo,
| ^^^^^^ use of undeclared crate or module `pg_sys`
|
help: consider importing one of these items
|
1 + use pgrx::pg_sys;
|
1 + use pgrx::prelude::pg_sys;
|

error[E0433]: failed to resolve: use of undeclared type `PgHeapTuple`
--> tests/compile-fail/aggregate-functions-dont-run-forever.rs:50:21
|
50 | None => PgHeapTuple::new_composite_type(DOG_COMPOSITE_TYPE).unwrap(),
| ^^^^^^^^^^^ use of undeclared type `PgHeapTuple`
|
help: consider importing this struct
|
1 + use pgrx::heap_tuple::PgHeapTuple;
|

error[E0425]: cannot find value `DOG_COMPOSITE_TYPE` in this scope
--> tests/compile-fail/aggregate-functions-dont-run-forever.rs:50:53
|
50 | None => PgHeapTuple::new_composite_type(DOG_COMPOSITE_TYPE).unwrap(),
| ^^^^^^^^^^^^^^^^^^ not found in this scope

error[E0601]: `main` function not found in crate `$CRATE`
--> tests/compile-fail/aggregate-functions-dont-run-forever.rs:56:2
|
56 | }
| ^ consider adding a `main` function to `$DIR/tests/compile-fail/aggregate-functions-dont-run-forever.rs`
error[E0521]: borrowed data escapes outside of function
--> tests/compile-fail/aggregate-functions-dont-run-forever.rs:12:36
|
8 | #[pg_aggregate]
| ---------------
| |
| `fcinfo` is a reference that is only valid in the function body
| lifetime `'fcx` defined here
...
12 | type Args = pgrx::name!(value, pgrx::composite_type!('static, "Dog"));
| ^^^^
| |
| `fcinfo` escapes the function body here
| argument requires that `'fcx` must outlive `'static`

error[E0521]: borrowed data escapes outside of function
--> tests/compile-fail/aggregate-functions-dont-run-forever.rs:45:1
|
45 | #[pg_aggregate]
| ^^^^^^^^^^^^^^^
| |
| `fcinfo` is a reference that is only valid in the function body
| `fcinfo` escapes the function body here
| lifetime `'fcx` defined here
| argument requires that `'fcx` must outlive `'static`
|
= note: this error originates in the attribute macro `pg_aggregate` (in Nightly builds, run with -Z macro-backtrace for more info)
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
use pgrx::prelude::*;

#[pg_extern]
fn split(input: &'static str, pattern: &str) -> Vec<&'static str> {
input.split_terminator(pattern).collect()
}

fn main() {}
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
error: cannot find attribute `pg_extern` in this scope
--> tests/compile-fail/postgres-strings-arent-immortal.rs:1:3
|
1 | #[pg_extern]
| ^^^^^^^^^
|
help: consider importing one of these items
|
1 + use pgrx::pg_extern;
|
1 + use pgrx_macros::pg_extern;
|

error[E0601]: `main` function not found in crate `$CRATE`
--> tests/compile-fail/postgres-strings-arent-immortal.rs:4:2
|
4 | }
| ^ consider adding a `main` function to `$DIR/tests/compile-fail/postgres-strings-arent-immortal.rs`
error[E0521]: borrowed data escapes outside of function
--> tests/compile-fail/postgres-strings-arent-immortal.rs:4:10
|
3 | #[pg_extern]
| ------------ lifetime `'fcx` defined here
4 | fn split(input: &'static str, pattern: &str) -> Vec<&'static str> {
| __________^^^^^____________________________________________________-
| | |
| | `fcinfo` escapes the function body here
| | argument requires that `'fcx` must outlive `'static`
5 | | input.split_terminator(pattern).collect()
6 | | }
| |_- `fcinfo` is a reference that is only valid in the function body

0 comments on commit f6edb6f

Please sign in to comment.