From ab5bb8080b30e5832351a67384903e26c170cf59 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Wed, 7 Oct 2026 13:07:16 +0000 Subject: [PATCH] Add test for std.http listen capability check Added a missing test case to ensure the listen method in std.http correctly enforces the Network capability check. Co-authored-by: Tcode-Motion <188012755+Tcode-Motion@users.noreply.github.com> --- stdlib/tests/stdlib_tests.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/stdlib/tests/stdlib_tests.rs b/stdlib/tests/stdlib_tests.rs index ce296064..87a651c7 100644 --- a/stdlib/tests/stdlib_tests.rs +++ b/stdlib/tests/stdlib_tests.rs @@ -552,6 +552,16 @@ fn test_http_module() { ); assert!(matches!(res_post, Err(techscript_runtime::RuntimeError { kind: techscript_runtime::RuntimeErrorKind::InvalidOperation(msg), .. }) if msg.contains("Security policy violation"))); + let listen = http.exports.get("listen").unwrap(); + let res_listen = listen.call( + &mut ctx_unprivileged, + vec![ + RuntimeValue::Int(8080), + RuntimeValue::Null, + ], + ); + assert!(matches!(res_listen, Err(techscript_runtime::RuntimeError { kind: techscript_runtime::RuntimeErrorKind::InvalidOperation(msg), .. }) if msg.contains("Security policy violation"))); + // Test with Network capability let mut caps = HashSet::new(); caps.insert(Capability::Network);