From ee5c06fe3480e2c1d2bc6c5cfbe03c3af55a9f8d 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:52 +0000 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=A7=AA=20[add=20unit=20tests=20for=20?= =?UTF-8?q?register=5Fredis]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Tcode-Motion <188012755+Tcode-Motion@users.noreply.github.com> --- stdlib/src/redis.rs | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/stdlib/src/redis.rs b/stdlib/src/redis.rs index 8be06367..57f5298b 100644 --- a/stdlib/src/redis.rs +++ b/stdlib/src/redis.rs @@ -30,3 +30,40 @@ impl StdlibRegistry { ); } } + +#[cfg(test)] +mod tests { + use super::*; + use crate::StdlibRegistry; + use techscript_runtime::RuntimeContext; + + #[test] + fn test_register_redis() { + let mut registry = StdlibRegistry { + modules: std::collections::HashMap::new(), + }; + registry.register_redis(); + + assert!(registry.modules.contains_key("std.redis")); + let module = registry.modules.get("std.redis").unwrap(); + assert_eq!(module.name, "std.redis"); + assert_eq!(module.version, "1.0.0"); + assert!(module.exports.contains_key("connect")); + + let connect_func = module.exports.get("connect").unwrap(); + assert_eq!(connect_func.name(), "connect"); + assert_eq!(connect_func.arity(), 1); + + use techscript_runtime::RuntimeConfig; + let mut ctx = RuntimeContext::new(RuntimeConfig::default()); + let res = connect_func.call( + &mut ctx, + vec![RuntimeValue::Str("redis://localhost".to_string())], + ); + assert!(res.is_ok()); + assert_eq!( + res.unwrap(), + RuntimeValue::Str("Redis not yet available".to_string()) + ); + } +} From af4ac9ba013b0bdee6e89483e9793c028c438b39 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:10:24 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=A7=AA=20[add=20unit=20tests=20for=20?= =?UTF-8?q?register=5Fredis]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Tcode-Motion <188012755+Tcode-Motion@users.noreply.github.com>