From a0349b1b8c3f38eef88c3a06ef636f105dedad23 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 27 Oct 2026 18:11:09 +0000 Subject: [PATCH 1/2] test: add unit tests for register_redis in stdlib Co-authored-by: Tcode-Motion <188012755+Tcode-Motion@users.noreply.github.com> --- stdlib/src/redis.rs | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/stdlib/src/redis.rs b/stdlib/src/redis.rs index 8be06367..022334c2 100644 --- a/stdlib/src/redis.rs +++ b/stdlib/src/redis.rs @@ -30,3 +30,37 @@ impl StdlibRegistry { ); } } + +#[cfg(test)] +mod tests { + use super::*; + use techscript_runtime::context::{RuntimeConfig, RuntimeContext}; + + #[test] + fn test_register_redis() { + let mut registry = StdlibRegistry::new(); + registry.register_redis(); + + assert!(registry.has_module("std.redis")); + let module = registry.get_module("std.redis").unwrap(); + assert_eq!(module.name, "std.redis"); + assert_eq!(module.version, "1.0.0"); + assert!(module.exports.contains_key("connect")); + + let connect_fn = module.exports.get("connect").unwrap(); + assert_eq!(connect_fn.name(), "connect"); + assert_eq!(connect_fn.arity(), 1); + + let mut ctx = RuntimeContext::new(RuntimeConfig::default()); + let res = connect_fn + .call( + &mut ctx, + vec![RuntimeValue::Str("redis://127.0.0.1:6379".to_string())], + ) + .unwrap(); + assert_eq!( + res, + RuntimeValue::Str("Redis not yet available".to_string()) + ); + } +} From 1956ee133f3aed2b550f68e1cf7ed6ffb64b3919 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 27 Oct 2026 19:09:11 +0000 Subject: [PATCH 2/2] test: add unit tests for register_redis in stdlib Co-authored-by: Tcode-Motion <188012755+Tcode-Motion@users.noreply.github.com>