File tree 1 file changed +8
-6
lines changed 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -190,15 +190,16 @@ mod tests {
190
190
191
191
#[ pg_test]
192
192
#[ search_path( @extschema@) ]
193
- #[ should_panic = "environment variable `PATH ` not defined at compile time." ]
193
+ #[ should_panic = "environment variable `FOOBAR ` not defined at compile time." ]
194
194
#[ cfg( feature = "trusted" ) ]
195
195
fn plrust_block_env ( ) -> spi:: Result < ( ) > {
196
196
let definition = r#"
197
- CREATE FUNCTION get_path () RETURNS text AS $$
198
- let path = env!("PATH ");
199
- Ok(Some(path .to_string()))
197
+ CREATE FUNCTION get_foobar () RETURNS text AS $$
198
+ let foo = env!("FOOBAR ");
199
+ Ok(Some(foo .to_string()))
200
200
$$ LANGUAGE plrust;
201
201
"# ;
202
+ std:: env:: set_var ( "FOOBAR" , "1" ) ;
202
203
Spi :: run ( definition)
203
204
}
204
205
@@ -208,12 +209,13 @@ mod tests {
208
209
#[ cfg( feature = "trusted" ) ]
209
210
fn plrust_block_option_env ( ) -> spi:: Result < ( ) > {
210
211
let definition = r#"
211
- CREATE FUNCTION try_get_path () RETURNS text AS $$
212
- let v = option_env!("PATH ")
212
+ CREATE FUNCTION try_get_foobar2 () RETURNS text AS $$
213
+ let v = option_env!("FOOBAR2 ")
213
214
.expect("the `option_env` macro always returns `None` in the PL/Rust user function");
214
215
Ok(Some(v.to_string()))
215
216
$$ LANGUAGE plrust;
216
217
"# ;
218
+ std:: env:: set_var ( "FOOBAR2" , "1" ) ;
217
219
Spi :: run ( definition)
218
220
}
219
221
You can’t perform that action at this time.
0 commit comments