From 48dd8d8439d1c7e1f94a69f7336b1db3f13935b1 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 8 Sep 2026 08:20:14 +0000 Subject: [PATCH] test: Add missing test for module registration in sys.rs This commit adds a test case to `stdlib_tests.rs` to verify that the `std.fs` and `std.time` modules are correctly registered by `sys.rs`, and that their respective exports and required capabilities are correctly configured. Co-authored-by: Tcode-Motion <188012755+Tcode-Motion@users.noreply.github.com> --- stdlib/tests/stdlib_tests.rs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/stdlib/tests/stdlib_tests.rs b/stdlib/tests/stdlib_tests.rs index f7df969f..d6bfff0b 100644 --- a/stdlib/tests/stdlib_tests.rs +++ b/stdlib/tests/stdlib_tests.rs @@ -1151,3 +1151,31 @@ fn test_ai_generate_text() { let val = res.unwrap(); assert!(val.as_string().unwrap().contains("Prompt: What is 2+2?")); } + +#[test] +fn test_sys_module_registration() { + let registry = StdlibRegistry::new(); + + // Verify std.fs module + let fs_module = registry + .get_module("std.fs") + .expect("std.fs module should be registered"); + assert_eq!(fs_module.name, "std.fs"); + assert!(fs_module + .required_capabilities + .contains(&Capability::FileSystem)); + + assert!(fs_module.exports.contains_key("read_file")); + assert!(fs_module.exports.contains_key("write_file")); + assert!(fs_module.exports.contains_key("exists")); + + // Verify std.time module + let time_module = registry + .get_module("std.time") + .expect("std.time module should be registered"); + assert_eq!(time_module.name, "std.time"); + assert!(time_module.required_capabilities.is_empty()); + + assert!(time_module.exports.contains_key("now")); + assert!(time_module.exports.contains_key("sleep")); +}