pinakes-core: fix hasher usage in tests

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: Ied03277d450e39299470667ef479c3526a6a6964
This commit is contained in:
raf 2026-03-19 23:57:48 +03:00
commit 5b817e0b3e
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
3 changed files with 21 additions and 8 deletions

View file

@ -1567,21 +1567,27 @@ mod tests {
#[test] #[test]
fn test_expand_env_var_simple() { fn test_expand_env_var_simple() {
let vars = FxHashMap::from([("TEST_VAR_SIMPLE", "test_value")]); let vars = [("TEST_VAR_SIMPLE", "test_value")]
.into_iter()
.collect::<FxHashMap<_, _>>();
let result = expand_env_vars("$TEST_VAR_SIMPLE", test_lookup(&vars)); let result = expand_env_vars("$TEST_VAR_SIMPLE", test_lookup(&vars));
assert_eq!(result.unwrap(), "test_value"); assert_eq!(result.unwrap(), "test_value");
} }
#[test] #[test]
fn test_expand_env_var_braces() { fn test_expand_env_var_braces() {
let vars = FxHashMap::from([("TEST_VAR_BRACES", "test_value")]); let vars = [("TEST_VAR_BRACES", "test_value")]
.into_iter()
.collect::<FxHashMap<_, _>>();
let result = expand_env_vars("${TEST_VAR_BRACES}", test_lookup(&vars)); let result = expand_env_vars("${TEST_VAR_BRACES}", test_lookup(&vars));
assert_eq!(result.unwrap(), "test_value"); assert_eq!(result.unwrap(), "test_value");
} }
#[test] #[test]
fn test_expand_env_var_embedded() { fn test_expand_env_var_embedded() {
let vars = FxHashMap::from([("TEST_VAR_EMBEDDED", "value")]); let vars = [("TEST_VAR_EMBEDDED", "value")]
.into_iter()
.collect::<FxHashMap<_, _>>();
let result = let result =
expand_env_vars("prefix_${TEST_VAR_EMBEDDED}_suffix", test_lookup(&vars)); expand_env_vars("prefix_${TEST_VAR_EMBEDDED}_suffix", test_lookup(&vars));
assert_eq!(result.unwrap(), "prefix_value_suffix"); assert_eq!(result.unwrap(), "prefix_value_suffix");
@ -1589,7 +1595,9 @@ mod tests {
#[test] #[test]
fn test_expand_env_var_multiple() { fn test_expand_env_var_multiple() {
let vars = FxHashMap::from([("VAR1", "value1"), ("VAR2", "value2")]); let vars = [("VAR1", "value1"), ("VAR2", "value2")]
.into_iter()
.collect::<FxHashMap<_, _>>();
let result = expand_env_vars("${VAR1}_${VAR2}", test_lookup(&vars)); let result = expand_env_vars("${VAR1}_${VAR2}", test_lookup(&vars));
assert_eq!(result.unwrap(), "value1_value2"); assert_eq!(result.unwrap(), "value1_value2");
} }
@ -1636,14 +1644,18 @@ mod tests {
#[test] #[test]
fn test_expand_env_var_underscore() { fn test_expand_env_var_underscore() {
let vars = FxHashMap::from([("TEST_VAR_NAME", "value")]); let vars = [("TEST_VAR_NAME", "value")]
.into_iter()
.collect::<FxHashMap<_, _>>();
let result = expand_env_vars("$TEST_VAR_NAME", test_lookup(&vars)); let result = expand_env_vars("$TEST_VAR_NAME", test_lookup(&vars));
assert_eq!(result.unwrap(), "value"); assert_eq!(result.unwrap(), "value");
} }
#[test] #[test]
fn test_expand_env_var_mixed_syntax() { fn test_expand_env_var_mixed_syntax() {
let vars = FxHashMap::from([("VAR1_MIXED", "v1"), ("VAR2_MIXED", "v2")]); let vars = [("VAR1_MIXED", "v1"), ("VAR2_MIXED", "v2")]
.into_iter()
.collect::<FxHashMap<_, _>>();
let result = let result =
expand_env_vars("$VAR1_MIXED and ${VAR2_MIXED}", test_lookup(&vars)); expand_env_vars("$VAR1_MIXED and ${VAR2_MIXED}", test_lookup(&vars));
assert_eq!(result.unwrap(), "v1 and v2"); assert_eq!(result.unwrap(), "v1 and v2");

View file

@ -775,6 +775,7 @@ impl HostFunctions {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use pinakes_plugin_api::PluginContext; use pinakes_plugin_api::PluginContext;
use rustc_hash::FxHashMap;
use super::*; use super::*;
@ -836,7 +837,7 @@ mod tests {
let mut context = PluginContext { let mut context = PluginContext {
data_dir: "/tmp/data".into(), data_dir: "/tmp/data".into(),
cache_dir: "/tmp/cache".into(), cache_dir: "/tmp/cache".into(),
config: HashMap::new(), config: FxHashMap::default(),
capabilities: Default::default(), capabilities: Default::default(),
}; };

View file

@ -1172,7 +1172,7 @@ pub trait StorageBackend: Send + Sync + 'static {
/// Create a backup of the database to the specified path. /// Create a backup of the database to the specified path.
/// ///
/// Only supported for SQLite (uses VACUUM INTO). PostgreSQL /// Only supported for `SQLite` (uses VACUUM INTO). `PostgreSQL`
/// deployments should use `pg_dump` directly; this method returns /// deployments should use `pg_dump` directly; this method returns
/// `PinakesError::InvalidOperation` for unsupported backends. /// `PinakesError::InvalidOperation` for unsupported backends.
async fn backup(&self, _dest: &std::path::Path) -> Result<()> { async fn backup(&self, _dest: &std::path::Path) -> Result<()> {