Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(harness): add test module for execution spec

Steven Enamakel175149b94d67
diff --git a/crates/openhuman-core/src/agent/harness/definition/execution_spec.rs b/crates/openhuman-core/src/agent/harness/definition/execution_spec.rs
index 2ba4e81b56..e1ce5c484d 100644
--- a/crates/openhuman-core/src/agent/harness/definition/execution_spec.rs
+++ b/crates/openhuman-core/src/agent/harness/definition/execution_spec.rs
@@ -81,3 +81,7 @@ pub enum SandboxMode {
/// Drop privileges, restrict filesystem (Landlock / Bubblewrap).
Sandboxed,
}
+
+#[cfg(test)]
+#[path = "execution_spec_tests.rs"]
+mod tests;
diff --git a/crates/openhuman-core/src/agent/harness/definition/execution_spec_tests.rs b/crates/openhuman-core/src/agent/harness/definition/execution_spec_tests.rs
new file mode 100644
index 0000000000..bc1d66ab2b
--- /dev/null
+++ b/crates/openhuman-core/src/agent/harness/definition/execution_spec_tests.rs
@@ -0,0 +1,15 @@
+use super::*;
+
+#[test]
+fn only_a_named_scope_listing_a_spawn_tool_names_one() {
+ let named = |names: &[&str]| ToolScope::Named(names.iter().map(|n| (*n).to_string()).collect());
+ for spawn in SPAWN_TOOL_NAMES {
+ assert!(named(&["memory", spawn]).names_a_spawn_tool(), "{spawn}");
+ }
+ assert!(!named(&["memory", "cron"]).names_a_spawn_tool());
+ assert!(!named(&[]).names_a_spawn_tool());
+ assert!(
+ !ToolScope::Wildcard.names_a_spawn_tool(),
+ "a wildcard names nothing"
+ );
+}