Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita868029

Browse files
committed
Add testcase back.
1 parent3bb2680 commita868029

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

‎pgml-extension/src/config.rs‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ use lazy_static::lazy_static;
22
use pgrx::{GucContext,GucFlags,GucRegistry,GucSetting};
33
use std::ffi::CStr;
44

5+
#[cfg(any(test, feature ="pg_test"))]
6+
use pgrx::{pg_schema, pg_test};
7+
58
lazy_static!{
69
pubstatic refPGML_VENV:(&'staticstr,GucSetting<Option<&'staticCStr>>) =
710
("pgml.venv",GucSetting::<Option<&'staticCStr>>::new(None));
@@ -59,3 +62,17 @@ pub fn set_config(name: &str, value: &str) -> Result<(), pgrx::spi::Error> {
5962
let query =format!("SELECT set_config('{name}', '{value}', false);");
6063
pgrx::Spi::run(&query)
6164
}
65+
66+
#[cfg(any(test, feature ="pg_test"))]
67+
#[pg_schema]
68+
mod tests{
69+
usesuper::*;
70+
71+
#[pg_test]
72+
fnread_pgml_huggingface_whitelist(){
73+
let name ="pgml.huggingface_whitelist";
74+
let value ="meta-llama/Llama-2-7b";
75+
set_config(name, value).unwrap();
76+
assert_eq!(PGML_HF_WHITELIST.1.get().unwrap().to_string_lossy(), value);
77+
}
78+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp