From b9f473e87fd2a5a3f147ec742d3536e2bee97a1e Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 15 Sep 2026 08:14:55 +0000 Subject: [PATCH] Split overly long test function in stdlib_tests.rs Co-authored-by: Tcode-Motion <188012755+Tcode-Motion@users.noreply.github.com> --- stdlib/tests/stdlib_tests.rs | 39 +++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/stdlib/tests/stdlib_tests.rs b/stdlib/tests/stdlib_tests.rs index 8fe9cdf7..da2a94f2 100644 --- a/stdlib/tests/stdlib_tests.rs +++ b/stdlib/tests/stdlib_tests.rs @@ -915,11 +915,9 @@ fn test_async_and_channels() { } #[test] -fn test_crypto_hash_and_compression() { +fn test_hash_operations() { let registry = StdlibRegistry::new(); - let crypto = registry.get_module("std.crypto").unwrap(); let hash = registry.get_module("std.hash").unwrap(); - let compress = registry.get_module("std.compress").unwrap(); let mut config_unprivileged = RuntimeConfig::default(); config_unprivileged @@ -927,11 +925,6 @@ fn test_crypto_hash_and_compression() { .remove(&Capability::FileSystem); let mut ctx_unprivileged = RuntimeContext::new(config_unprivileged); - let mut config_fs = RuntimeConfig::default(); - config_fs.capabilities.insert(Capability::FileSystem); - let mut ctx_fs = RuntimeContext::new(config_fs); - - // 1. Test hash operations let md5_fn = hash.exports.get("md5").unwrap(); let val = md5_fn .call( @@ -961,8 +954,19 @@ fn test_crypto_hash_and_compression() { ) .unwrap(); assert!(val.as_int().is_some()); +} + +#[test] +fn test_crypto_operations() { + let registry = StdlibRegistry::new(); + let crypto = registry.get_module("std.crypto").unwrap(); + + let mut config_unprivileged = RuntimeConfig::default(); + config_unprivileged + .capabilities + .remove(&Capability::FileSystem); + let mut ctx_unprivileged = RuntimeContext::new(config_unprivileged); - // 2. Test crypto operations (AES-GCM & Bcrypt) let aes_enc = crypto.exports.get("aes_encrypt").unwrap(); let aes_dec = crypto.exports.get("aes_decrypt").unwrap(); @@ -1010,8 +1014,23 @@ fn test_crypto_hash_and_compression() { .call(&mut ctx_unprivileged, vec![pass, hashed.clone()]) .unwrap(); assert_eq!(is_valid.as_bool(), Some(true)); +} + +#[test] +fn test_compression_operations() { + let registry = StdlibRegistry::new(); + let compress = registry.get_module("std.compress").unwrap(); + + let mut config_unprivileged = RuntimeConfig::default(); + config_unprivileged + .capabilities + .remove(&Capability::FileSystem); + let mut ctx_unprivileged = RuntimeContext::new(config_unprivileged); + + let mut config_fs = RuntimeConfig::default(); + config_fs.capabilities.insert(Capability::FileSystem); + let mut ctx_fs = RuntimeContext::new(config_fs); - // 3. Test compression capabilities & operations let temp_dir = std::env::temp_dir().join("techscript_archive_test"); std::fs::create_dir_all(&temp_dir).ok();